-
Notifications
You must be signed in to change notification settings - Fork 273
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
Add response headers to all responses #932
Conversation
Codecov Report
@@ Coverage Diff @@
## master #932 +/- ##
==========================================
+ Coverage 91.97% 91.98% +0.01%
==========================================
Files 120 120
Lines 3400 3405 +5
Branches 699 700 +1
==========================================
+ Hits 3127 3132 +5
Misses 273 273
Continue to review full report at Codecov.
|
lib/fetch/fetchRequest.ts
Outdated
const result: HttpResponse = { | ||
responseText: isObject ? JSON.stringify(data) : data as string, | ||
status: status | ||
status: status, | ||
responseHeaders |
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.
how about name it as headers
?
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.
Renamed
dca6b15
to
f805edf
Compare
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.
Please also add changelog (new feature)
f805edf
to
4bedbf2
Compare
4bedbf2
to
a0e5b10
Compare
OKTA-412511 <<<Jenkins Check-In of Tested SHA: a0e5b10 for [email protected]>>> Artifact: okta-auth-js Files changed count: 15 PR Link: "#932"
Expose request headers in new
responseHeaders
property. Value is object filled with response headers key-value pairs.This can be useful to get X-Rate-Limit-* headers as requested in #230
Another solution could be exposing the whole
Response
object instead (eg. in propertyrawResponse
, then headers could be accessed withHeaders
API).But that approach leads to problems with unit testing and caching responses (complications with serialization and mocking
Fetch API
objects).Internal ref: OKTA-412511
Resolves #230
Important
Most headers are not accessible in browsers due to CORS. (In Node environment it works fine)
Access-Control-Expose-Headers
should be set from server-side to allow web clients to useX-Rate-Limit-*
etc. headers