• Caio Marcelo de Oliveira Filho's avatar
    net/http/httptest: record trailing headers in ResponseRecorder · c69e6869
    Caio Marcelo de Oliveira Filho authored
    Trailers() returns the headers that were set by the handler after the
    headers were written "to the wire" (in this case HeaderMap) and that
    were also specified in a proper header called "Trailer".
    
    Neither HeaderMap or trailerMap (used for Trailers()) are manipulated by
    the handler code, instead a third stagingMap is given to the
    handler. This avoid a reference kept by handler to affect the recorded
    results.
    
    If a handler just modify the header but doesn't call any Write or Flush
    method from ResponseWriter (or Flusher) interface, HeaderMap will not be
    updated. In this case, calling Flush in the recorder is enough to get
    the HeaderMap filled.
    
    Fixes #14531.
    Fixes #8857.
    
    Change-Id: I42842341ec3e95c7b87d7e6f178c65cd03d63cc3
    Reviewed-on: https://go-review.googlesource.com/20047Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    c69e6869
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...