Skip to content
Snippets Groups Projects
  • 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.