Skip to content
Myr

refactor(render): remove headers parameter from writeHeader (#4353)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Name · committed by GitHub · parent cca98d2 · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: 1911860538 <alxps1911@gmail.com>

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:render/reader.go+4 added-4 removed
25 unmodified lines
26 r.Headers = map[string]string{}27 }28 r.Headers["Content-Length"] = strconv.FormatInt(r.ContentLength, 10)29 }30 r.writeHeaders(w, r.Headers)30 r.writeHeaders(w)31 _, err = io.Copy(w, r.Reader)32 return33}34
1 unmodified line
36func (r Reader) WriteContentType(w http.ResponseWriter) {37 writeContentType(w, []string{r.ContentType})38}3940// writeHeaders writes custom Header.41func (r Reader) writeHeaders(w http.ResponseWriter, headers map[string]string) {40// writeHeaders writes headers from r.Headers into response.41func (r Reader) writeHeaders(w http.ResponseWriter) {42 header := w.Header()43 for k, v := range headers {43 for k, v := range r.Headers {44 if header.Get(k) == "" {45 header.Set(k, v)46 }47 }
1 unmodified line