mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 01:17:18 +00:00
refactor(main) writeHead -> setHeader
This commit is contained in:
parent
8a86bf2875
commit
4dd931756f
1 changed files with 12 additions and 5 deletions
|
|
@ -242,7 +242,9 @@
|
|||
query : getQuery(p.request)
|
||||
});
|
||||
|
||||
p.response.writeHead(OK, header);
|
||||
//p.response.writeHead(OK, header);
|
||||
setHeader(header, p.response);
|
||||
p.response.statusCode = p.status || OK;
|
||||
|
||||
pipe.create({
|
||||
from : p.name,
|
||||
|
|
@ -314,13 +316,18 @@
|
|||
* redirect to another URL
|
||||
*/
|
||||
function redirect(pParams) {
|
||||
var lRet = Util.checkObjTrue(pParams,
|
||||
[RESPONSE]);
|
||||
var p, header,
|
||||
lRet = Util.checkObjTrue(pParams, [RESPONSE]);
|
||||
|
||||
if (lRet) {
|
||||
var p = pParams;
|
||||
p = pParams;
|
||||
|
||||
p.response.writeHead(MOVED_PERMANENTLY, {'Location': p.url});
|
||||
header = {
|
||||
'Location': p.url
|
||||
},
|
||||
|
||||
setHeader(header, p.response);
|
||||
p.response.statusCode = MOVED_PERMANENTLY;
|
||||
p.response.end();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue