Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Link header pagination only parsing first rel #5257

Copy link
Copy link
@dddugan

Description

@dddugan
Issue body actions

Steps to reproduce

$uri_base = 'https://MYDEVORG.okta.com'
$apikey = 'MYAPIKEY'
$uri = $uri_base + '/api/v1/users/?filter=status eq "STAGED"&limit=200'
$method = 'GET'
$headers = @{'Accept'='application/json';'Content-Type'='application/json';'Authorization'="SSWS $apikey"}

PS /> $json = Invoke-RestMethod -Uri $uri -Method $method -Headers $headers -FollowRelLink
PS /> $json.Count
200
PS /> $webreq= Invoke-WebRequest -Uri $uri -Method $method -Headers $headers
PS /> $webreq.RelationLink

Key  Value
---  -----
self https://MYDEVORG.okta.com/api/v1/users?limit=200&filter=status+eq+%22STAGED%22


PS /> $webreq.Headers.Link
<https://MYDEVORG.okta.com/api/v1/users?limit=200&filter=status+eq+%22STAGED%22>; rel="self"
<https://MYDEVORG.okta.com/api/v1/users?after=OKTAUSERID&limit=200&filter=status+eq+%22STAGED%22>; rel="next"
PS />

Expected behavior

Invoke-RestMethod should follow the next rel link and return additional results.
Invoke-WebRequest RelationLink dictionary should contain both "self" and "next".

Actual behavior

Only the first value from $webreq.Headers.Link is parsed into RelationLink.

Environment data

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial
> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.0-beta.9
PSEdition                      Core
GitCommitId                    v6.0.0-beta.9
OS                             Linux 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

References

Related commit: 40446c8
Related RFC: https://github.com/PowerShell/PowerShell-RFC/blob/master/2-Draft-Accepted/RFC0021-Link-header-based-pagination-for-WebCmdlets.md

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Resolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.