Haskell-OpenAPI-Client-Code-Generator icon indicating copy to clipboard operation
Haskell-OpenAPI-Client-Code-Generator copied to clipboard

Support Common Header

Open StevenXL opened this issue 1 year ago • 1 comments

Some APIs require a specific header to be sent with all requests. For example, in Recurly:

// https://recurly.com/developers/api/v2021-02-25/#section/Getting-Started/Versioning

WARNING: Specifying a version is required to get a successful response.

This is not supported by the OpenAPI Specification, as far as I can tell. However, would it be able to add this feature as an option to the generator?

Thinking off the top of my head, we could expand the config data type with a new field of type Request -> Request. createBaseRequest can do what it currently does, plus that new field. The new field could be field in with user-supplied code, maybe via the configuration file.

StevenXL avatar Aug 26 '24 16:08 StevenXL

Hey @StevenXL

We had a similar discussion some time ago which led to the conclusion that for the moment, a custom implementation of our MonadHttp is sufficient to achieve what you are asking for, see this comment for a great example given by a member of the community.

I think this should work for you as well, let me know if you disagree, thank you.

joel-bach avatar Sep 02 '24 13:09 joel-bach