Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gRPC responses doesn't support setting up custom headers #128

Open
vronin opened this issue Jan 2, 2025 · 0 comments
Open

gRPC responses doesn't support setting up custom headers #128

vronin opened this issue Jan 2, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@vronin
Copy link

vronin commented Jan 2, 2025

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

  1. Create a mapping with custom headers in the response tag.
  2. Have a client doing gRPC call (resulting in UnaryServerCall)
  3. Check the response headers on the client side.
  4. 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

@vronin vronin added the bug Something isn't working label Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant