Skip to content

Allow specyfing the Content-Type headers that should be encoded as Binary/Base64 #321

@andrezimmermann

Description

@andrezimmermann

Is your feature request related to a problem? Please describe.
I'm using Hoverfly to capture some HTTP interactions, while most API I've recording are JSON, I sometimes stumble into downloading some CSV files that aren't UTF-8, leading to invalid simulations being captured/recorded.

I end up having to manually edit the captured simulation file by hand which takes some time

Describe the solution you'd like
I'd like to be able to set on the HoverflyConfig, a list of the headers should be automatically encoded into the Base64

As example

@HoverflyCapture(
    config = @HoverflyConfig(
        // Force Hoverfly to treat these types as binary, triggering Base64 encoding
        binaryTypes = {"text/plain", "application/xml", "text/csv"} 
    )
)

Describe alternatives you've considered
I tried to running a middleware to edit the response to replace the Content-Type header from application application/x-csv;charset=windows-31j to application/octet-stream the middleware approach doesn't work when capturing since the response data becomes {"response":{"status":0,"body":"","encodedBody":false}, ... }

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions