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.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.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.title = The question ui title. (default: 'Server')
|
||||
* 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
|
||||
|
||||
* test in production
|
||||
* Server header set+check support
|
||||
* Server header check support
|
||||
* Redo css(?divs) of server question
|
||||
* Add table+instance websql options so it can also be used in application code.
|
||||
* 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.
|
||||
* Strip question value to hostname+port before use and validating.
|
||||
* Allow user upgrade to https in question input from default of transport option.
|
||||
|
||||
* Added request headers setting.
|
||||
|
||||
### 0.0.4
|
||||
* Added auto cache clean code
|
||||
|
|
|
@ -69,10 +69,10 @@
|
|||
timeout: 4096,
|
||||
flag: 'FFServerUrl',
|
||||
header: {
|
||||
request: { // TODO: add header support
|
||||
'X-FFSpaLoader': '42'
|
||||
request: {
|
||||
'X-FFSpaLoader': 'sync'
|
||||
},
|
||||
response: {
|
||||
response: { // TODO: add header check support
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -316,6 +316,12 @@
|
|||
httpRequest.ontimeout = function() {
|
||||
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();
|
||||
};
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"description": "Javascript Single Page Application Loader",
|
||||
"main": "es5-ff-spa-loader.js",
|
||||
"scripts": {
|
||||
"prepublish": "gulp build",
|
||||
"prepublish": "gulp build",
|
||||
"clean": "gulp clean",
|
||||
"build": "gulp build",
|
||||
"test": "gulp test"
|
||||
|
@ -28,11 +28,11 @@
|
|||
],
|
||||
"license": "BSD-2-Clause",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"type": "git",
|
||||
"url": "https://bitbucket.org/im_ik/es5-ff-spa-loader.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://bitbucket.org/im_ik/es5-ff-spa-loader/issues"
|
||||
"url": "https://bitbucket.org/im_ik/es5-ff-spa-loader/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp": "^3.9.0",
|
||||
|
|
Loading…
Reference in a new issue