feat: set content-type to application/json (#2160)

master
Kevin Wan 2 years ago committed by GitHub
parent 557383fbbf
commit 4324ddc024
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -108,6 +108,8 @@ func (s *Server) buildHandler(source grpcurl.DescriptorSource, resolver jsonpb.A
timeout := internal.GetTimeout(r.Header, s.timeout) timeout := internal.GetTimeout(r.Header, s.timeout)
ctx, can := context.WithTimeout(r.Context(), timeout) ctx, can := context.WithTimeout(r.Context(), timeout)
defer can() defer can()
w.Header().Set(httpx.ContentType, httpx.JsonContentType)
if err := grpcurl.InvokeRPC(ctx, source, cli.Conn(), m.RpcPath, internal.BuildHeaders(r.Header), if err := grpcurl.InvokeRPC(ctx, source, cli.Conn(), m.RpcPath, internal.BuildHeaders(r.Header),
handler, parser.Next); err != nil { handler, parser.Next); err != nil {
httpx.Error(w, err) httpx.Error(w, err)

Loading…
Cancel
Save