Browse Source

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

Kevin Wan 2 năm trước cách đây
mục cha
commit
4324ddc024
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      gateway/server.go

+ 2 - 0
gateway/server.go

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