mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add test case for preventing following redirect
This commit is contained in:
parent
36105412b1
commit
61f6535be8
@ -796,6 +796,25 @@ describe('HTTP Request Node', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should prevent following redirect when msg.followRedirects is false', function(done) {
|
||||||
|
var flow = [{id:"n1",type:"http request",wires:[["n2"]],method:"GET",ret:"txt",url:getTestURL('/redirectToText')},
|
||||||
|
{id:"n2", type:"helper"}];
|
||||||
|
helper.load(httpRequestNode, flow, function() {
|
||||||
|
var n1 = helper.getNode("n1");
|
||||||
|
var n2 = helper.getNode("n2");
|
||||||
|
n2.on("input", function(msg) {
|
||||||
|
try {
|
||||||
|
msg.should.have.property('statusCode',302);
|
||||||
|
msg.should.have.property('responseUrl', getTestURL('/redirectToText'));
|
||||||
|
done();
|
||||||
|
} catch(err) {
|
||||||
|
done(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
n1.receive({payload:"foo",followRedirects:false});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('shuold output an error when request timeout occurred', function(done) {
|
it('shuold output an error when request timeout occurred', function(done) {
|
||||||
var flow = [{id:"n1",type:"http request",wires:[["n2"]],method:"GET",ret:"obj",url:getTestURL('/timeout')},
|
var flow = [{id:"n1",type:"http request",wires:[["n2"]],method:"GET",ret:"obj",url:getTestURL('/timeout')},
|
||||||
{id:"n2", type:"helper"}];
|
{id:"n2", type:"helper"}];
|
||||||
|
Loading…
Reference in New Issue
Block a user