Merge pull request #143 from unistack-org/headers

dont mangle header names
This commit is contained in:
Василий Толстов 2023-02-13 00:12:07 +03:00 committed by GitHub
commit 7f1a55958e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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()