Skip to content

Matching GET requests with query #92

Description

@willm

Is it possible to stub requests with specific query strings?

The following works fine (note the absence of a query string in the call to stub:

        stub(http(.get, uri: "/test?id=123"), json(["check": "ok"], status: 200))
        var request = URLRequest(url: URL(string: "http://somehost.com/test?id=123")!)
        request.httpMethod = "GET"
        var match = http(.get, uri: "/test")(request)
        XCTAssertTrue(match)

However adding a query to the uri in the call to stub fails:

        stub(http(.get, uri: "/test?id=123"), json(["check": "ok"], status: 200))
        var request = URLRequest(url: URL(string: "http://somehost.com/test?id=123")!)
        request.httpMethod = "GET"
        var match = http(.get, uri: "/test?id=123")(request)
        XCTAssertTrue(match)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions