I'm running into an issue with trying to mock an e...
# help
s
I'm running into an issue with trying to mock an endpoint that I can't figure out what is happening. I'm attempting to use a simple url, method, header match on the request, and when I submit the request, it says it doesn't match seemingly based on the header Real Request
Copy code
POST /v1/token HTTP/1.1
Host: localhost:54287
traceparent: oa-2a7ac95c456e05294be1ff5e58083ee8-kaldfjl
Content-Type: application/json
Content-Length: 22

{
    "test": true
}
Mapping - only included a portion that was relevant
Copy code
"request": {
                "url": "/v1/token",
                "method": "POST",
                "headers": {
                    "traceparent": {
                        "contains": "2a7ac95c456e05294be1ff5e58083ee8"
                    }
                }
            }
I'm checking the various endpoints to diagnose like the near misses endpoints, but I can't see any revelant information as to why it wouldn't match. Is there any other things I can check like adding better logging in the docker container that wiremock is running inside?
r
pretty hard to diagnose without all the information. if you can create a repo that reproduces the problem i can take a look
you can run wiremock with the --verbose argument to see the logged requests
s
I discovered the docker
WIREMOCK_OPTIONS: '--verbose'
to enable more logs
l
Did you get anything that helped in the verbose logs?
s
I don't believe so. I do have the near misses call that returns data, but I can't see anything that stands out with it. The odd thing is that I had previously gotten this to work with seemingly the exact same call. The only thing I'm doing differently is using the Wiremock.Org.Abstractions library that is tied to Wiremock.Net and manually creating my own client methods to post to the admin endpoints to create the mappings
l
Ah, I am not a .Net dev unfortunately. I wonder if you can get this working in WireMock standalone to see if we can isolate the problem a little. Other than that, providing an example app might be useful like already mentioned or posting in the #C059E0MBM29 channel might be a good idea
s
Thank you, I didn't realize that channel existed, I will post there
It looks like the issue was related to an additional property being sent in the code (I had not manually configured this),
"fromConfiguredStub": false
that causes it to not match the proper stub
I'm not entirely sure what the purpose is around this property even with the description.
l
Not sure what that is either. That must be something specific to the .Net library
s
It's in the base API as well, but I think the .net library is always passing it instead of only passing it when its set
l
Ah, yes so it is. I haven't seen that before. Will have to investigate that further
s
I'll make a note on the .net library that has this issue and potentially have them have fields that aren't required to be nullable.
l
Awesome. Glad you worked it out in the end