dont mangle header names #143

Merged
vtolstov merged 1 commits from headers into v3 2023-02-13 00:12:08 +03:00
Showing only changes of commit 02f9d6d8f7 - Show all commits

View File

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