Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

stubs to return 404s always error used to work #31

Open
bklooste opened this issue Feb 17, 2022 · 3 comments
Open

stubs to return 404s always error used to work #31

bklooste opened this issue Feb 17, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@bklooste
Copy link

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 bklooste added the bug Something isn't working label Feb 17, 2022
@Adven27
Copy link
Owner

Adven27 commented Feb 17, 2022

@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?

@bklooste
Copy link
Author

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.

@Adven27
Copy link
Owner

Adven27 commented Feb 18, 2022

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants