Skip to content

Issue with URL Encoding of space character in query parameter #125

@thomas-br

Description

@thomas-br

In pact artifact files generated out of pact-consumer-swift tests I am facing issues with URL encoding.
With the example test:

mockServiceInstance
    .uponReceiving("example request")
    .given("example")
    .withRequest(
        method: .GET,
        path: "/example/odata",
        query: ["$orderby": "CreatedAt desc"]
    )
    .willRespondWith(status: 200)

In the pact file under interaction, the URL is constructed like the following:

"request": {
        "method": "get",
        "path": "/example/odata",
        "query": "$orderby=CreatedAt+desc"
      },

The space in query is unfortunately encoded as a + instead of a %20 which is leading to issues with certain providers running the verification against their systems. Some libraries seem to be very picky of the expected escaped space whether to expect %20 or +. This is currently blocking the implementation of pact tests on provider side.

Is there a way of configuring pact-consumer-swift to escape with a %20 or somehow influence how the pact json is generated?

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