Feature/custom headers (issue #169)
This PR implements the ability to add custom headers to responses. It follows the steps outlined in #169 except it does not use var EnvVars = map[string]string{ and instead references the .env variable in the config.yaml, because custom headers need a custom key ('apiKey' for example) and this seemed the most straightforward and user-friendly solution. All tests passed and the lint passed.
I'm not sure how to best implement ApplyCustomHeaders in routes.go. Right now the custom headers attach to every response, which does not seem right. Any direction and help finalizing would be much appreciated!
:rocket: This PR description was created by Ellipsis for commit 135b0ddb998d9396c6e5843a3c06521eb5520346.
Summary:
This PR adds the ability to include custom headers in server responses, defined in config.yaml, and applies them to every response via a new middleware function ApplyCustomHeaders.
Key points:
- Added
CustomHeadersfield inServerConfigstruct inconfig/models.go - Defined custom headers in
config.yaml - Implemented
ApplyCustomHeadersfunction inpkg/server/middleware.goto add custom headers to responses - Added
ApplyCustomHeadersto middleware stack inpkg/server/routes.go
Generated with :heart: by ellipsis.dev