-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Labels
Hacktoberfest-AcceptedAccepted to participate in HacktoberfestAccepted to participate in HacktoberfestIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module
Description
Calling Invoke-RestMethod will ignore the Retry-After header provided when hitting api rate limits retrying after 5 seconds even if the response specified wait time is longer than that.
Steps to reproduce
Invoke-RestMethod -Uri https://ins-httpstatus.azurewebsites.net/429 -MaximumRetryCount 2 -VerboseExpected behavior
VERBOSE: GET https://ins-httpstatus.azurewebsites.net/429 with 0-byte payload
VERBOSE: Retrying after interval of 10 seconds. Status code for previous attempt: TooManyRequests
VERBOSE: Retrying after interval of 10 seconds. Status code for previous attempt: TooManyRequests
VERBOSE: received 0-byte response of content type
Invoke-RestMethod: Response status code does not indicate success: 429 (Too Many Requests).
Actual behavior
VERBOSE: GET https://ins-httpstatus.azurewebsites.net/429 with 0-byte payload
VERBOSE: Retrying after interval of 5 seconds. Status code for previous attempt: TooManyRequests
VERBOSE: Retrying after interval of 5 seconds. Status code for previous attempt: TooManyRequests
VERBOSE: received 0-byte response of content type
Invoke-RestMethod: Response status code does not indicate success: 429 (Too Many Requests).
Environment data
Name Value
---- -----
PSVersion 7.1.0-preview.5
PSEdition Core
GitCommitId 7.1.0-preview.5
OS Darwin 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Name Value
---- -----
PSVersion 7.0.2
PSEdition Core
GitCommitId 7.0.2
OS Darwin 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
The uri that I am hitting above is just a simple Function App with the following proxy:
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"429": {
"matchCondition": {
"route": "/429"
},
"responseOverrides": {
"response.statusCode": "429",
"response.headers.Retry-After": "10"
}
}
}
}Metadata
Metadata
Assignees
Labels
Hacktoberfest-AcceptedAccepted to participate in HacktoberfestAccepted to participate in HacktoberfestIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module