-
Notifications
You must be signed in to change notification settings - Fork 8.1k
[Feature] Add Multiple Link Header Support #5265
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
Conversation
iSazonov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave a comment
| $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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo - ses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
| _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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc says that there is no null.
Closed.
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.