Open
Description
Proposal
gRPC supports setting custom response HTTP headers.
I attempted to implement this based on an example in the README, specifically the section on setting up headers:
{
"request" : {
"urlPath" : "/com.example.grpc.GreetingService/greeting",
"method" : "POST",
"bodyPatterns" : [{
"equalToJson" : "{ \"name\": \"Tom\" }"
}]
},
"response" : {
"status" : 200,
"body" : "{\n \"greeting\": \"Hi Tom\"\n}",
"headers" : {
"grpc-status-name" : "OK"
}
}
}
I modified the headers key and value to include a custom header. While the header tag was accepted (i.e., WireMock didn't throw any errors), it doesn't appear in the response.
I reviewed the wiremock-grpc-extension codebase but couldn't locate code or tests handling this behavior. That said, I might have missed something since I'm not very familiar with the codebase.
Supporting custom headers in gRPC responses would be useful.
BTW. Please let me know if I am missing anything.
Reproduction steps
- Create a mapping with custom headers in the
response
tag. - Have a client doing gRPC call (resulting in
UnaryServerCall
) - Check the response headers on the client side.
- Observed headers:
content-type: application/grpc
grpc-encoding: identity
grpc-accept-encoding: gzip
grpc-status: 0
However, custom headers are not present in the response.
References
No response
Activity