Skip to content
Snippets Groups Projects
Select Git revision
  • aac468e9b634dca075399b5441cf86e044e14451
  • main default protected
  • drip-server-timing
  • compress-middleware
  • v2.11.0
  • v2.10.0
  • v2.9.2
  • v2.9.1
  • v2.9.0
  • v2.8.0
  • v2.7.0
  • v2.6.0
  • v2.5.6
  • v2.5.5
  • v2.5.4
  • v2.5.3
  • v2.5.2
  • v2.5.1
  • v2.5.0
  • v2.4.2
  • v2.4.1
  • v2.4.0
  • v2.3.0
  • v2.2.2
24 results

middleware.go

  • Will McCutchen's avatar
    aac468e9
    Rework JSON serialization (#94) · aac468e9
    Will McCutchen authored
    Instead of serializing JSON to a temporary slice of bytes before writing
    to the response, instead write directly to the response.
    
    Also, pretty-print JSON responses for better readability (and to match
    httpbin).
    
    Note: With this change, we rely much more on the underlying net/http
    server's implicit handling of the Content-Length header. One notable
    side effect of this is that responses to HEAD requests no longer include
    a Content-Length.
    Rework JSON serialization (#94)
    Will McCutchen authored
    Instead of serializing JSON to a temporary slice of bytes before writing
    to the response, instead write directly to the response.
    
    Also, pretty-print JSON responses for better readability (and to match
    httpbin).
    
    Note: With this change, we rely much more on the underlying net/http
    server's implicit handling of the Content-Length header. One notable
    side effect of this is that responses to HEAD requests no longer include
    a Content-Length.