dont mangle header names

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2023-02-13 00:09:54 +03:00
parent 82beddb09b
commit 02f9d6d8f7

View File

@ -79,16 +79,16 @@ func (h *httpServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
md = metadata.New(len(r.Header) + 8)
}
for k, v := range r.Header {
md.Set(k, strings.Join(v, ", "))
md[k] = strings.Join(v, ", ")
}
md.Set("RemoteAddr", r.RemoteAddr)
md.Set("Method", r.Method)
md.Set("URL", r.URL.String())
md.Set("Proto", r.Proto)
md.Set("ContentLength", fmt.Sprintf("%d", r.ContentLength))
md.Set("TransferEncoding", strings.Join(r.TransferEncoding, ","))
md.Set("Host", r.Host)
md.Set("RequestURI", r.RequestURI)
md["RemoteAddr"] = r.RemoteAddr
md["Method"] = r.Method
md["URL"] = r.URL.String()
md["Proto"] = r.Proto
md["ContentLength"] = fmt.Sprintf("%d", r.ContentLength)
md["TransferEncoding"] = strings.Join(r.TransferEncoding, ",")
md["Host"] = r.Host
md["RequestURI"] = r.RequestURI
ctx = metadata.NewIncomingContext(ctx, md)
defer r.Body.Close()