Skip to content

v5.9.0 release notes

  • Added CommonWriter.Writer() to retrieve the underlying writer.
  • Compression:
    • Fixed an error raised in case of no content responses (HTTP 204 notably) when using the compress middleware.
    • Added the header Vary: Accept-Encoding if a response is compressed.
    • Set the Content-Encoding header only if the response is compressed. The header won't be added anymore for no content responses.
  • Prevent Response.JSON() and Response.String() from overriding the response status after the headers have been written, which could lead to incorrect information given to other components such as the access logger.
  • Error handling edge cases improvements:
    • The panic status handler (500) is now executed too if an error happens after writing to the response. Previously, the panic status handler was executed just like any other status handler: only if the response is empty. This allows better error handling in scenarios such as streaming, SSE, etc.
    • The panic status handler (500) doesn't attempt to write to the response body anymore if a non-500 header has already been written.
    • The recovery middleware doesn't override the status if header has already been written. This avoids inconsistencies between real response and logged response.