haskell-servant / haskell-servant/servant

Get raw ByteString out of a non-raw API client

Open
#1,856 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
2k
Forks
427
Avg merge
2d 23h
Merged PRs (30d)
5

Description

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 `Verb`s 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.