Переглянути джерело

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

Kevin Wan 2 роки тому
батько
коміт
4324ddc024
1 змінених файлів з 2 додано та 0 видалено
  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)