Skip to content

Commit

Permalink
feat: set content-type to application/json (zeromicro#2160)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevwan authored Jul 17, 2022
1 parent 557383f commit 4324ddc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gateway/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ func (s *Server) buildHandler(source grpcurl.DescriptorSource, resolver jsonpb.A
timeout := internal.GetTimeout(r.Header, s.timeout)
ctx, can := context.WithTimeout(r.Context(), timeout)
defer can()

w.Header().Set(httpx.ContentType, httpx.JsonContentType)
if err := grpcurl.InvokeRPC(ctx, source, cli.Conn(), m.RpcPath, internal.BuildHeaders(r.Header),
handler, parser.Next); err != nil {
httpx.Error(w, err)
Expand Down

0 comments on commit 4324ddc

Please sign in to comment.