Skip to content

Get raw ByteString out of a non-raw API client #1856

@lrworth

Description

@lrworth

We have an API type representing a 3rd-party API that we want to use with servant-client. Our response type definitions only implement a subset of the response from the API.

Now, we want to use the same servant API definition to fetch the (unparsed) raw data from the 3rd-party service to store in a database for archiving. Using the existing stuff in servant-client-core, is it possible to access the raw response, including headers, without having to replicate the HasClient machinery to change how Verbs are handled? We'd like to be able to write the standard genericClient // endpoint /: param and get the full response back (or at least the raw body).

We also considered building an alternative runRequestAcceptStatus to log the raw responses in addition to the standard behaviour, but this would cause client requests to fail if the response could not be parsed into the declared type, even though we don't need the parsed version.

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