grpc-ecosystem/grpc-gateway

Unsupported HEAD call to known URL does not return error response body.

Open

#1680 aperta il 21 set 2020

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)Go (2250 fork)batch import
bughelp wanted

Metriche repository

Star
 (16.971 star)
Metriche merge PR
 (Merge medio 8g 23h) (147 PR mergiate in 30 g)

Descrizione

🐛 Bug Report

When performing a HTTP call using an unsupported method, for example when making a POST request to a URL that only supports GET, I get a http-501-error-response from the gateway. The response body contains the grpc error code 12 ("Unimplemented") with the message "Method Not Allowed".

When performing a HEAD-call to the same get-only-URL, I expect the same error response. What happens is that the http request fails with 501 (which is correct), but the response body stays empty. According to the documentation, the HEAD call should not have any special behaviour, so I expect the body to contain the same error details. An error-response-body should never be empty. Docs: https://cloud.google.com/service-infrastructure/docs/service-management/reference/rpc/google.api#special-notes

To Reproduce

  1. Define a gRPC endpoint with only a GET-http-mapping (or any other method).
  2. Generate and start the grpc-gateway
  3. Perform a http HEAD-call to the same URL.
  4. The response (status 501) will have an empty body.

Your Environment

Im using github.com/grpc-ecosystem/grpc-gateway/v2 v2.0.0-beta.4

Guida contributor