mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
GRPC mappings are not created correctly when created through Admin API #663
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @misiek150 on GitHub (Jan 8, 2025).
Originally assigned to: @StefH on GitHub.
Describe the bug
It looks like mappings for GRPC call are not created correctly when created through __admin/mappings endpoint. It doesn't matter if we register proto at server level or pass its content to mapping response and request, directly. Created mapping miss some parts which causes requests to fail (returning 404 status code).
When proto is registered at server level following parts are not created despite the fact they are included in the JSON request for creating mappings:
When proto is passed as text directly (for request and response) following parts are not created despite the fact they are included in the JSON request for creating mappings:
Expected behavior:
Above parts of the mapping are created thus mapping works correctly and the same way as if they were created through code at server start.
Test to reproduce
Start server with below code, register attached proto, don't add any mappings, e.g.:
Proto definition:
Register following mapping through __admin/mappings endpoint:
Inspect mapping using __admin/mappings endpoint for missing parts of the mapping.
Sample code to get server working correctly (i.e. return proper response to client):
__admin/mappings endpoint may be used to obtain JSON mappings, posted earlier in this post.
Other related info
In case there is any problem with the approach I take, or maybe there is some specific convention required in terms of JSON mapping I tried I am more than happy to be corrected.
@StefH commented on GitHub (Jan 9, 2025):
@misiek150
Can you try preview
1.6.11-ci-19563?https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions
@misiek150 commented on GitHub (Jan 11, 2025):
Hmm I am not sure if there is still an issue or I am doing something wrong.
I switched to 1.6.11-ci-19563. I am using below proto:
and load it with "greet" ID like:
Server configuration:
I run it and I am able to get successful response from the servier using postman. Now, I am getting mapping via __admin/mappings:
I delete all the mappings, paste above JSON into file, then post it back to the server via __admin/mappings with curl
curl -X POST --header "Content-Type: application/json" --data @C:\temp\WiremockMappings2.json http://localhost:80/__admin/mappings.If I get mapping again using
curl http://localhost:80/__admin/mappingsI do see all the fields so the problem I initially described seems to be fixed. However, if I call server again using postman, I am constantly getting 404 error.Can you try replicating above situation? Maybe I am doing some dumb mistake on my side. Hard to say as mapping itself looks fine.
@StefH commented on GitHub (Jan 13, 2025):
@misiek150
I can replicate this error and it's fixed and I've added an extra unit test.
Can you test preview version
1.6.11-ci-19569?@StefH commented on GitHub (Jan 17, 2025):
@misiek150
Can you please try to check?
@misiek150 commented on GitHub (Jan 26, 2025):
Sorry I've been unavailable, I should be able to check next week