mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
feature(ponse) redirect: params -> url, response
This commit is contained in:
parent
73a4dc157a
commit
49588ced04
2 changed files with 10 additions and 18 deletions
|
|
@ -104,10 +104,7 @@
|
|||
|
||||
url = protocol + hostName + sslPort + req.url;
|
||||
|
||||
ponse.redirect({
|
||||
response: res,
|
||||
url: url
|
||||
});
|
||||
ponse.redirect(url, res);
|
||||
};
|
||||
|
||||
Util.log('* Redirection http -> https is setted up');
|
||||
|
|
|
|||
|
|
@ -309,21 +309,16 @@
|
|||
/**
|
||||
* redirect to another URL
|
||||
*/
|
||||
function redirect(pParams) {
|
||||
var p, header,
|
||||
lRet = Util.checkObjTrue(pParams, [RESPONSE]);
|
||||
function redirect(url, response) {
|
||||
var header = {
|
||||
'Location': url
|
||||
};
|
||||
|
||||
if (lRet) {
|
||||
p = pParams;
|
||||
|
||||
header = {
|
||||
'Location': p.url
|
||||
};
|
||||
|
||||
setHeader(header, p.response);
|
||||
p.response.statusCode = MOVED_PERMANENTLY;
|
||||
p.response.end();
|
||||
}
|
||||
Util.checkArgs(arguments, ['url', 'response']);
|
||||
|
||||
setHeader(header, response);
|
||||
response.statusCode = MOVED_PERMANENTLY;
|
||||
response.end();
|
||||
}
|
||||
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue