Skip to content

WithHeader bug fix

Choose a tag to compare

@gebes gebes released this 16 Dec 09:30
· 75 commits to main since this release
19efd95

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))