Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

Don't unnecessarily add ? to URL if parameter dictionary is empty.#424

Closed
ryanmaxwell wants to merge 1 commit intoAFNetworking:masterfrom
ryanmaxwell:master
Closed

Don't unnecessarily add ? to URL if parameter dictionary is empty.#424
ryanmaxwell wants to merge 1 commit intoAFNetworking:masterfrom
ryanmaxwell:master

Conversation

@ryanmaxwell
Copy link
Copy Markdown

No description provided.

@mattt
Copy link
Copy Markdown
Contributor

mattt commented Jul 24, 2012

I'm sympathetic to this, but I think that empty parameters adding a ? is actually a good behavior.

If someone really wanted to omit the query string, they would just pass nil parameters. There is indeed a functional reason why someone would want to append a blank query string, and that's to invalidate cache. I couldn't tell you if anyone has specifically used this feature, but I wouldn't want to introduce a potentially-breaking change without a clear advantage.

@mattt mattt closed this Jul 24, 2012
@ryanmaxwell
Copy link
Copy Markdown
Author

Right. That's one reason - generally I would add a timestamp param or similar to clear cache.
Where this behaviour of the empty array was getting me, was I was passing mutable array that may or may not have elements.

I don't particularly mind as it wasn't breaking anything for me, It would just execute this code path that had unnecessary calculations.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants