spring-cloud-gateway
spring-cloud-gateway copied to clipboard
Fix grpc status headers
Fixes #2961
Headers are only set, if they are received.
In case the status comes with the first header and is an error response.setComplete() is called to set endStream=true and prevent an empty DATA frame being sent. This would lead to Received unexpected EOS on DATA frame from server errors otherwise on the grpc client side.
@FliegenKLATSCH Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
@FliegenKLATSCH Thank you for signing the Contributor License Agreement!
Can you add a test? @abelsromero @Albertoimpl can you review
@spencergibb Any hints on how I could set trailing headers for a test case? Doesn't seem to be easy :/ (The patch is running in our production environment since half a year, without any issue.)
I don't. Let's wait for my co-workers tagged above to respond
Thanks for the ping @spencergibb, and thanks a lot @FliegenKLATSCH for the contribution and for wanting to improve our tests around it. To add custom headers and trailers we can add to our integration-test application a custom interceptor.
For headers, it should be something like this: https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/header/HeaderServerInterceptor.java
For trailers what you see in the close: https://github.com/grpc/grpc-java/blob/master/interop-testing/src/main/java/io/grpc/testing/integration/TestServiceImpl.java#L587-L590
Thank you! Ping for review @Albertoimpl @abelsromero
These assertions should cover the case, thanks @FliegenKLATSCH!