diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-01-25 20:23:25 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-01-25 20:23:25 +0300 |
commit | 21755ac9e9e349c4291e6f64109abe0b4588436d (patch) | |
tree | e8123e81ef63ebd7d9936042d6bd3a66e6a8760d /app/assets/javascripts/lib | |
parent | 43dc6263526dbbb7dab44d91406c36b07ce2829b (diff) | |
parent | b55c1bc4b5fb8d259ba9f264eff607f81012fa39 (diff) |
Merge branch 'master' into copy-as-md
# Conflicts:
# app/assets/javascripts/lib/utils/common_utils.js.es6
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js.es6 | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js.es6 b/app/assets/javascripts/lib/utils/common_utils.js.es6 index e2503ca305c..51993bb3420 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js.es6 +++ b/app/assets/javascripts/lib/utils/common_utils.js.es6 @@ -215,5 +215,19 @@ const matchingNodes = parentNode.querySelectorAll(selector); return Array.prototype.indexOf.call(matchingNodes, node) !== -1; }; + + /** + this will take in the headers from an API response and normalize them + this way we don't run into production issues when nginx gives us lowercased header keys + */ + w.gl.utils.normalizeHeaders = (headers) => { + const upperCaseHeaders = {}; + + Object.keys(headers).forEach((e) => { + upperCaseHeaders[e.toUpperCase()] = headers[e]; + }); + + return upperCaseHeaders; + }; })(window); }).call(this); |