[Feature] Add Multiple Link Header Support#5265
Merged
TravisEz13 merged 2 commits intoPowerShell:masterfrom Nov 1, 2017
Merged
[Feature] Add Multiple Link Header Support#5265TravisEz13 merged 2 commits intoPowerShell:masterfrom
TravisEz13 merged 2 commits intoPowerShell:masterfrom
Conversation
iSazonov
reviewed
Oct 30, 2017
| $result.Output.RelationLink["last"] | Should BeExactly "http://localhost:8080/PowerShell?test=linkheader&maxlinks=5&linknumber=5" | ||
| } | ||
|
|
||
| # Test pending support for multiple header capable server on Linux/macOS ses issue #4639 |
iSazonov
reviewed
Oct 31, 2017
| _relationLink.Add(rel, absoluteUri.AbsoluteUri.ToString()); | ||
| string url = match.Groups["url"].Value; | ||
| string rel = match.Groups["rel"].Value; | ||
| if (url != String.Empty && rel != String.Empty && !_relationLink.ContainsKey(rel)) |
Collaborator
There was a problem hiding this comment.
I don't know if match.Success is true enough to exclude an exception. It seems safer to check String.IsNullOrEmpty() for url and rel.
Contributor
Author
There was a problem hiding this comment.
I don't know if match.Success
In this instance, it probably is. We are assured a string for both link and pattern so long as we don't mess with the pattern Regex.Match will never except and it true it the 2 indexes will exist in matches.
I agree on the String.IsNullOrEmpty() but the point of this PR is to address the Multiple Link Header issue, not to change this logic. Should that be done in a separate PR?
PaulHigin
approved these changes
Oct 31, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #5257
Adds support for the following response Header scenario:
CoreFX treats multiple header responses as separate array elements. Unless each array element is parsed, only the first one would be accepted. The current implimentation not only returns an incomplete
RelationLinkdictionary, but also breaks-FollowRelLinkwhen a sever responds with multiple Link headers. This PR corrects both the pagination and dictionary.The test can currently only be done on Windows as we currently lack a native server that supports returning multiple headers with the same name (see #4639). The test would only result in a false pass on Linux and macOS.