mirror of
https://github.com/OAuthSwift/OAuthSwift.git
synced 2026-04-26 20:55:57 +03:00
[GH-ISSUE #640] OAuthSwiftHTTPRequest old headers overriding new headers #423
Labels
No labels
bug
cocoapod
duplicate
enhancement
feature-request
help wanted
help wanted
invalid
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/OAuthSwift#423
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mariuskurgonas on GitHub (Dec 28, 2020).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/640
Description:
OAuthSwiftHTTPRequest.swift line 423:
self.urlRequest.allHTTPHeaderFields = requestHeaders + headersHere
requestHeadersare potentially new headers set after the access token was refreshed andheadersare old headers.Problems comes when both variables contain the same key and different value. When merging with a + operator in swift - it takes the last elements values.
So after token refresh if there was a new access token header set on
requestHeadersandheaderscontained old value,in the end the final headers would contain the old value.
THE FIX:
Reverse the order or variables being merged like:
self.urlRequest.allHTTPHeaderFields = headers + requestHeadersOAuth Provider? (Twitter, Github, ..):
OAuth Version:
OS (Please fill the version) :
Installation method:
Library version:
Xcode version:
11.4 (Swift 5.2)
11.x (Swift 5.1)
10.x (Swift 5.0)
other: (Please fill in the version you are using.)
objective c
swift