mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Add test case for preventing following redirect
This commit is contained in:
		| @@ -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) { | ||||
|             var flow = [{id:"n1",type:"http request",wires:[["n2"]],method:"GET",ret:"obj",url:getTestURL('/timeout')}, | ||||
|                 {id:"n2", type:"helper"}]; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user