simonireilly / compeller

A strong typescript binding for your OpenAPI Schema that doesn't need generation and is not prescriptive in coding style
MIT License
22 stars 1 forks source link

feat: add response header support for responders where headers are optional in response but keys are required when added #32

Closed simonireilly closed 2 years ago

simonireilly commented 2 years ago

Response headers are necessary in order to declare content type.

From this perspective, we need to have an additional consideration.

When content-type is application/json we should be sending a default header for that, but that is a bit of a reach, the library isn't really for that. Instead, we should enforce the typing of such headers, and make the user meet the contract.

If they wished to always provide that header, they could do so with a custom responder that returns that header.

closes: #24