summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/lib/utils
diff options
context:
space:
mode:
authorRegis <boudinot.regis@yahoo.com>2017-01-24 09:56:26 -0700
committerRegis <boudinot.regis@yahoo.com>2017-01-24 09:56:26 -0700
commit14b1d69b150f4e241fb6a47009e2b00c9520a199 (patch)
treedb7b4638b2b17dd619ece6f1dc536f783364ce3f /app/assets/javascripts/lib/utils
parent30d5e9fa54e0beacfb9b28c307543ff359f17668 (diff)
downloadgitlab-ce-normalize_frontend_headers.tar.gz
use gl.utils.normalizeHeaders in pipelines storenormalize_frontend_headers
Diffstat (limited to 'app/assets/javascripts/lib/utils')
-rw-r--r--app/assets/javascripts/lib/utils/common_utils.js.es614
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 6d57d31f380..7452879d9a3 100644
--- a/app/assets/javascripts/lib/utils/common_utils.js.es6
+++ b/app/assets/javascripts/lib/utils/common_utils.js.es6
@@ -159,5 +159,19 @@
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
};
+
+ /**
+ 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);