1

Is there is a way i can return the content-type= " application/html" from the server.

grpc-gateway returning the response in key-value pair and browsers are unable parse it.

Proto Defination:

  rpc Create (RegId) returns (Resp);

message RegId {
  string id = 1;
}

message Resp {
  string response = 1;
}
Returning response as HTML but in key-value pair. 

How can i just return the html

{"response":"\u003chtml\u003e\u003cb\u003e Hey Developer \u003c/b\u003e\u003c/html\u003e"}
user1844634
  • 1,221
  • 2
  • 17
  • 35

1 Answers1

0

Try to use runtime.HTTPBodyMarshaler (https://github.com/grpc-ecosystem/grpc-gateway/issues/1881#issuecomment-797384040) for your grpc server, for example define runtime.ServeMuxOption in this way

runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.HTTPBodyMarshaler{&runtime.JSONPb{EmitDefaults: true}})