kopia lustrzana https://github.com/c9/core
use setHeader iso writeHead
rodzic
9b3e007435
commit
bcfb026450
|
@ -7,7 +7,8 @@ module.exports = function(options, imports, register) {
|
||||||
var trustedDomainsRe = options.trustedDomainsRe || /.*/;
|
var trustedDomainsRe = options.trustedDomainsRe || /.*/;
|
||||||
|
|
||||||
imports.connect.addResponseMethod("redirect", function(location) {
|
imports.connect.addResponseMethod("redirect", function(location) {
|
||||||
this.writeHead(302, {Location: location});
|
this.setHeader("Location", location);
|
||||||
|
this.writeHead(302);
|
||||||
this.end("");
|
this.end("");
|
||||||
});
|
});
|
||||||
imports.connect.addResponseMethod("secureRedirect", function(location) {
|
imports.connect.addResponseMethod("secureRedirect", function(location) {
|
||||||
|
@ -15,9 +16,8 @@ module.exports = function(options, imports, register) {
|
||||||
|
|
||||||
if (!trustedDomainsRe.test(parsedLocation.host))
|
if (!trustedDomainsRe.test(parsedLocation.host))
|
||||||
location = parsedLocation.path;
|
location = parsedLocation.path;
|
||||||
|
|
||||||
this.writeHead(302, {Location: location});
|
this.redirect(location);
|
||||||
this.end("");
|
|
||||||
});
|
});
|
||||||
imports.connect.addResponseMethod("returnTo", function(req, defaultReturn) {
|
imports.connect.addResponseMethod("returnTo", function(req, defaultReturn) {
|
||||||
var url = defaultReturn || "/";
|
var url = defaultReturn || "/";
|
||||||
|
|
Ładowanie…
Reference in New Issue