Adven27/grpc-wiremock

stubs to return 404s always error used to work

Opened this issue · 3 comments

Describe the bug
Whe i setup a return { status = 404, jsonBody = "" } it always gives a http error no matter for what i do

grpcmock_1 | io.adven.grpc.wiremock.BadHttpResponseException:
grpcmock_1 | at io.adven.grpc.wiremock.HttpMock$Response.getMessage(HttpMock.java:113) ~[main/:na]
grpcmock_1 | at io.adven.grpc.wiremock.Translator$WireMockTranslator.redirect(Translator.java:49) ~[main/:na]

Expected behavior
404s return bodies should not conform to the grpc call

@bklooste Hi, thanks for the report! Does the response have Code: NotFound like this:

curl -X POST http://localhost:8888/__admin/mappings \                                                             
  -d '{
    "request": {
        "method": "POST",
        "url": "/BalanceService/getUserBalance"
    },
    "response": {
        "status": 404,
        "jsonBody": {
        }
    }
}'
                                                                                                                                                                                                    
grpcurl -plaintext localhost:50000 api.wallet.BalanceService/getUserBalance
  
ERROR:
  Code: NotFound
  Message: {}

If so it's for the error emulation purposes and described here.

Could you please elaborate more on what are you intended to use wiremock response status for?

It throws a huge exception stack in the container logs but still return 404 ( I think ) as that is the default this part of the code has a generic handler. Havent tried it with 400.

I still didn't understand what does grpc call return.
The huge exception stack in logs isn't an issue unless grpc response is correct:

ERROR:
  Code: NotFound
  Message: <some message>

What is the output of the following terminal command:

grpcurl -plaintext localhost:50000 my.grpc.service/Method

where my.grpc.service/Method is your service endpoint.