Skip to content

Matching rules on response headers do not work #184

@rafsojka

Description

@rafsojka

Hello,

I have a pact containing:

"response": {
                "status": 404,
                "headers": {
                    "Content-Type": "application/json; charset=UTF-8"
                },
                "body": {
                    // body sample
                },
                "matchingRules": {
                    "$.header.Content-Type": {
                        "match": "regex",
                        "regex": "^application\\/json; charset=(utf|UTF)-8$"
                    },
                   // body matching rules
            },

when running verification I am getting:

Failure/Error: expect(header_value).to match_header(name, expected_header_value)
       Expected header "Content-Type" to equal "application/json; charset=UTF-8", but was "application/json; charset=utf-8"

The regex provided clearly matches both "application/json; charset=utf-8" (lowercase utf) and "application/json; charset=UTF-8" (uppercase UTF).

Does that mean that regex matching rules are not supported for headers?

Edit:

I have just spotted that I am also getting a warning in verification output:

WARN: Ignoring unsupported matching rules {"match"=>"regex", "regex"=>"^application\\/json; charset=(utf|UTF)-8$"} for path $['header']['Content-Type']

Similar warnings for query parameters and match"=>"number.

I understand that all these things are not supported in .NET.
Is there somewhere a complete, up-to-date list of what is supported in pact-net?

I am working on an API written in aspnetcore consumed from mobile apps.
We are trying to employ Pact for consumer driven contract testing so I am getting pact files generated in other technologies which as it seems, have greater capabilities.
Therefore a complete list of supported features that I can point client developers to would save lots of time on both ends.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions