Skip to content

RestRequest.responseObject overwrites queryItems #42

@svanimpe

Description

@svanimpe

It's possible to create a request and configure query parameters:

let request = RestRequest(url: "http://localhost:8090/api/races")
request.queryItems = [
    URLQueryItem(name: "first", value: "0"),
    URLQueryItem(name: "size", value: "10")
]

but then when you call request.responseObject { ... }, the query parameters get removed, because of this line:

https://github.com/IBM-Swift/SwiftyRequest/blob/2bf11cdf775da7c39a8658100a8c66f12d759109/Sources/SwiftyRequest/RestRequest.swift#L375

This is really confusing, as I didn't even notice responseObject had a queryItems parameter, with a default value of nil.

I assume this is a bug and the method's parameter shouldn't overwrite the queryItems property when that parameter is nil?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions