LukeMathWalker / wiremock-rs

HTTP mocking to test Rust applications.
Apache License 2.0
607 stars 69 forks source link

handle multiple header values #111

Closed yanns closed 1 year ago

yanns commented 1 year ago

When I try to assert on a header that can be appears multiple times in a request, it seems that wiremock only consider the first instance. When I send:

&service_name_headers = {
    "x-service-name": "TJ2K4cgLPB",
    "x-service-name": "kAQmNfsbYjWVdji",
    "x-service-name": "IGqauf",
    "x-service-name": "YNdLE3fEMi0",
}

The error from wiremock:

failed:
- Mock #0.
    Expected range of matching incoming requests: == 1
    Number of matched incoming requests: 0

Received requests:
- Request #1
    GET http://localhost/temporibus/feature-tags
accept: application/json
host: 127.0.0.1:60250
x-service-name: TJ2K4cgLPB

x-service-name appears only once here. When I check on "real" server, I can observe that all header values are present.

LukeMathWalker commented 1 year ago

How are you passing the multi-valued header in the request?

LukeMathWalker commented 1 year ago

It should be fixed in f8eb9a5 - I've released it as part of 0.5.18 👍🏻

yanns commented 1 year ago

I'm passing the multi-value with HeaderMap. I can confirm that the fix is working. Thanks a lot!