Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve query items without a value #73

Merged
merged 1 commit into from
Dec 22, 2015

Conversation

wessmith
Copy link
Member

Depends on #72

Technically keys missing values in a query string are legit (rfc3986) and we prefer when a url is parsed into a DPLDeepLink it is serialized into the same url.

Additionally note that NSURL interprets and preserves query data that is not complete key value pairs.

For example:

NSURL *url = [NSURL URLWithString:@"http://example.com?foo"];
NSLog(@"%@", url.query);

//logs the following
> foo

Currently DeepLinkKit will discard foo in this situation. This change set preserves the value as a key in -[DPLDeepLink queryParameters] with a placeholder value. Upon serialization, the key is placed back in the query of the URL with no value.

e.g. The query parameters of the url http://example.com?foo&bar=baz is represented as:

// deepLink.queryParameters
@{
  @"foo": @"",
  @"bar": @"baz"
}

serializing the deep link deepLink.URL restores the query to the same state.

@chrismaddern
Copy link
Contributor

LGTM. Let's clean up the P/R and separate out Gem / Project changes

@wessmith wessmith force-pushed the wes/preserve_non-pair_query_items branch from faaef5b to ef4f849 Compare December 17, 2015 20:45
@chrismaddern
Copy link
Contributor

LGTM

wessmith added a commit that referenced this pull request Dec 22, 2015
@wessmith wessmith merged commit 36d6799 into master Dec 22, 2015
@wessmith wessmith deleted the wes/preserve_non-pair_query_items branch December 22, 2015 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants