Added request headers
This commit is contained in:
parent
9b40d0e78a
commit
e65d557b4f
|
@ -88,6 +88,7 @@ A javascript library providing server defined loading of assets for a single pag
|
||||||
* server.assets = The server path to the assets resources definition file, is required (default: null)
|
* server.assets = The server path to the assets resources definition file, is required (default: null)
|
||||||
* server.timeout = The timeout to download the server resources. (default: 4096)
|
* server.timeout = The timeout to download the server resources. (default: 4096)
|
||||||
* server.flag = The window flag which is set when the server.url is know. (default: 'FFServerUrl')
|
* server.flag = The window flag which is set when the server.url is know. (default: 'FFServerUrl')
|
||||||
|
* server.header.request = An key value object with the request headers. (default: {'X-FFSpaLoader': 'sync'})
|
||||||
* question.transport = The transport to prefix the server.url with. (default: 'http://')
|
* question.transport = The transport to prefix the server.url with. (default: 'http://')
|
||||||
* question.title = The question ui title. (default: 'Server')
|
* question.title = The question ui title. (default: 'Server')
|
||||||
* question.text = The question ui text. (default: 'Please provide the server name;')
|
* question.text = The question ui text. (default: 'Please provide the server name;')
|
||||||
|
@ -155,7 +156,7 @@ A javascript library providing server defined loading of assets for a single pag
|
||||||
## Todo
|
## Todo
|
||||||
|
|
||||||
* test in production
|
* test in production
|
||||||
* Server header set+check support
|
* Server header check support
|
||||||
* Redo css(?divs) of server question
|
* Redo css(?divs) of server question
|
||||||
* Add table+instance websql options so it can also be used in application code.
|
* Add table+instance websql options so it can also be used in application code.
|
||||||
* Add more tests
|
* Add more tests
|
||||||
|
@ -175,7 +176,7 @@ Add unit tests for any new or changed functionality. Lint and test your code.
|
||||||
* Added question.validate.[min|max|regex].value|message options.
|
* Added question.validate.[min|max|regex].value|message options.
|
||||||
* Strip question value to hostname+port before use and validating.
|
* Strip question value to hostname+port before use and validating.
|
||||||
* Allow user upgrade to https in question input from default of transport option.
|
* Allow user upgrade to https in question input from default of transport option.
|
||||||
|
* Added request headers setting.
|
||||||
|
|
||||||
### 0.0.4
|
### 0.0.4
|
||||||
* Added auto cache clean code
|
* Added auto cache clean code
|
||||||
|
|
|
@ -69,10 +69,10 @@
|
||||||
timeout: 4096,
|
timeout: 4096,
|
||||||
flag: 'FFServerUrl',
|
flag: 'FFServerUrl',
|
||||||
header: {
|
header: {
|
||||||
request: { // TODO: add header support
|
request: {
|
||||||
'X-FFSpaLoader': '42'
|
'X-FFSpaLoader': 'sync'
|
||||||
},
|
},
|
||||||
response: {
|
response: { // TODO: add header check support
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -316,6 +316,12 @@
|
||||||
httpRequest.ontimeout = function() {
|
httpRequest.ontimeout = function() {
|
||||||
cb('timeout after '+options.server.timeout+' of url '+url);
|
cb('timeout after '+options.server.timeout+' of url '+url);
|
||||||
};
|
};
|
||||||
|
var headerKeys = Object.keys(options.server.header.request);
|
||||||
|
for (var headerKeyIdx in headerKeys) {
|
||||||
|
var headerKey = headerKeys[headerKeyIdx];
|
||||||
|
var headerValue = options.server.header.request[headerKey];
|
||||||
|
httpRequest.setRequestHeader(headerKey,headerValue);
|
||||||
|
}
|
||||||
httpRequest.send();
|
httpRequest.send();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"description": "Javascript Single Page Application Loader",
|
"description": "Javascript Single Page Application Loader",
|
||||||
"main": "es5-ff-spa-loader.js",
|
"main": "es5-ff-spa-loader.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublish": "gulp build",
|
"prepublish": "gulp build",
|
||||||
"clean": "gulp clean",
|
"clean": "gulp clean",
|
||||||
"build": "gulp build",
|
"build": "gulp build",
|
||||||
"test": "gulp test"
|
"test": "gulp test"
|
||||||
|
@ -28,11 +28,11 @@
|
||||||
],
|
],
|
||||||
"license": "BSD-2-Clause",
|
"license": "BSD-2-Clause",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://bitbucket.org/im_ik/es5-ff-spa-loader.git"
|
"url": "https://bitbucket.org/im_ik/es5-ff-spa-loader.git"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://bitbucket.org/im_ik/es5-ff-spa-loader/issues"
|
"url": "https://bitbucket.org/im_ik/es5-ff-spa-loader/issues"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "^3.9.0",
|
"gulp": "^3.9.0",
|
||||||
|
|
Loading…
Reference in a new issue