Make response headers available to the specs#1748
Merged
mkendall07 merged 5 commits intomasterfrom Oct 24, 2017
Merged
Conversation
matthewlane
approved these changes
Oct 23, 2017
mkendall07
reviewed
Oct 24, 2017
|
|
||
| function headerParser(xmlHttpResponse) { | ||
| return { | ||
| get: responseObj.getResponseHeader.bind(responseObj) |
Contributor
Author
There was a problem hiding this comment.
Paranoia... because I've been burned by this bugs too many times.
The root of the issue is: I don't know how browsers implement XMLHttpRequest.getResponseHeader.
Suppose I just did:
return {
get: responseObj.getResponseHeader
}
but then they implemented it as something like this:
XmlHttpRequest.prototype.getResponseHeader = function(header) {
var headers = this.parseResponseHeaders();
return headers[header];
}
When an adapter calls get, then this evaluates to our object--not the original XmlHttpRequest. Since we don't define parseResponseHeaders, it'd crash on an undefined function error.
I have no idea if this is a real risk... but the tl;dr is that this sucks. Since I can't eject it from the language, defensive binds keep the code safe.
Millerrok
pushed a commit
to Vertamedia/Prebid.js
that referenced
this pull request
Oct 25, 2017
* 'master' of https://github.com/prebid/Prebid.js: (414 commits) Make response headers available to the specs (prebid#1748) add option to run tests in a specific file (prebid#1727) Update JCM Adapter to 1.0 (prebid#1715) Finished an unfinished comment. (prebid#1749) Platform.io Bidder Adapter update. Prebid v1.0. (prebid#1705) Fix window.top.host cross origin issue when in nested iframes. (prebid#1730) fix log message not displaying when referencing missing bidder (prebid#1737) Allow more than one placement from one page (prebid#1692) Justpremium Adapter bugfix (prebid#1716) Updating license (prebid#1717) realvuBidAdapter (prebid#1571) Update JSDoc to call the module `pbjs` (prebid#1572) Update Beachfront adapter for v1.0 (prebid#1675) Update AdButler adapter for Prebid v1.0 (prebid#1664) Increment pre version Fix for prebid#1628 (allowing standard bidCpmAdjustment) (prebid#1645) Prebid 0.31.0 Release Support native click tracking (prebid#1691) Initial commit for video support for pbs (prebid#1706) Fixes: Immediate adapter response may end auction (prebid#1690) ...
This was referenced Oct 25, 2017
Merged
This was referenced Oct 26, 2017
Closed
8 tasks
1 task
This was referenced Nov 22, 2017
Merged
This was referenced Nov 28, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description of change
Some adapters need to pull information from their server's response headers.
This adds that feature, and updates existing adapters so they continue to work.
Other information
Fixes #1742.