Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixes #38 - gives access to xhr request headers via the .get api for …

…browser env
  • Loading branch information...
commit 9c5d8637a399eae1c83cdeedb66858b2a28cc6b7 1 parent e5b850a
@DimitarChristoff DimitarChristoff authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 text.js
View
13 text.js
@@ -251,10 +251,19 @@ define(['module'], function (module) {
};
} else if (masterConfig.env === 'xhr' || (!masterConfig.env &&
text.createXhr())) {
- text.get = function (url, callback, errback) {
- var xhr = text.createXhr();
+ text.get = function (url, callback, errback, headers) {
+ var xhr = text.createXhr(), header;
xhr.open('GET', url, true);
+ //Allow plugins direct access to xhr headers
+ if (headers) {
+ for (header in headers) {
+ if (headers.hasOwnProperty(header)) {
+ xhr.setRequestHeader(header.toLowerCase(), headers[header]);
+ }
+ }
+ }
+
//Allow overrides specified in config
if (masterConfig.onXhr) {
masterConfig.onXhr(xhr, url);
Please sign in to comment.
Something went wrong with that request. Please try again.