Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.
This repository was archived by the owner on May 6, 2025. It is now read-only.

Add Content-Type filters, so that certain binary formats do not end up as plain text when snapshotted. #10

@grebaldi

Description

@grebaldi

depends on: #8

Currently, any response coming from a server is treated like a text response.

This isn't optimal for binary formats like images.

It would be great, if those responses would be filtered through a Strategy-like Content-Type class that decides how the snapshot for a speficic Content-Type will be built.

For text responses, the default behavior of saving the snapshot inline with the template file will suffice.

For image responses, the image should be saved to an image file and the reponse template should stream that image file as the response body.

Content-Type strategies should be configurable via manifest (see: #8):

export const manifest: StrawmanManifest = {
  responses: {
    contentTypes: {
        "image/jpeg": new BinaryContentType({ extension: "jpeg" })
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions