You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
funchttpResponseModifier(ctx context.Context, w http.ResponseWriter, p protoiface.MessageV1) error {
fmt.Println("in response modifier") // debug:withContext(debugger::parent)md, ok:=runtime.ServerMetadataFromContext(ctx)
if!ok {
returnnil
}
// set http status codeifvals:=md.HeaderMD.Get("x-http-code"); len(vals) >0 {
code, err:=strconv.Atoi(vals[0])
iferr!=nil {
returnerr
}
w.WriteHeader(code)
// delete the headers to not expose any grpc-metadata in http responsedelete(md.HeaderMD, "x-http-code")
delete(w.Header(), "Grpc-Metadata-X-Http-Code")
}
returnnil
}
The piece in the documentation uses proto.Message but that throws an error:
Expected behavior
The forward response options should be executed.
Actual Behavior
The httpResponseModifier function does not execute. I tried adding code to the actual package to help me with debugging and mux.forwardResponseOptions does have a len() > 1 so I am not sure what's happening here.
Your Environment
macOS 10.15.5 (19F101)
go version go1.14.7 darwin/amd64
grpc-gateway 1.14.7
The text was updated successfully, but these errors were encountered:
Just updated the stack to v2, the error (in the image) went but the forwardResponseOptions are still not being executed. The code is absolutely the same (save the import as "github.com/grpc-ecosystem/grpc-gateway/v2/runtime".)
This would be easier to help with on our Slack support channel, #grpc-gateway on Gophers Slack. This isn't the best forum for this sort of debugging. Could we move this conversation there?
馃悰 Bug Report
When forward response options are provided to the runtime, they are not executed.
To Reproduce
Here,
httpResponseModifier
has the following definition (this is a direct copy of the related documentation):The piece in the documentation uses
proto.Message
but that throws an error:Expected behavior
The forward response options should be executed.
Actual Behavior
The
httpResponseModifier
function does not execute. I tried adding code to the actual package to help me with debugging andmux.forwardResponseOptions
does have alen() > 1
so I am not sure what's happening here.Your Environment
macOS 10.15.5 (19F101)
go version go1.14.7 darwin/amd64
grpc-gateway 1.14.7
The text was updated successfully, but these errors were encountered: