WithHeader bug fix
Changes
- The WithHeader wrapper now only sets header if they haven't been set before.
- This gives the option to override headers from other responses.
Example
We override the Json response Content-Type header from application/json to application/json; charset=utf-8. Because we set the header to application/json; charset=utf-8 the Header from the Json Response won't be set.
return WithHeaders(MapString{
"Content-Type": "application/json; charset=utf-8",
}, Json(StatusOK, data))