mirror of
				https://github.com/therootcompany/request.js.git
				synced 2024-11-16 17:28:58 +00:00 
			
		
		
		
	stop on form-data error
This commit is contained in:
		
							parent
							
								
									3defd84af4
								
							
						
					
					
						commit
						078f922635
					
				@ -20,5 +20,6 @@ request(
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    console.log('statusCode:', response.statusCode); // The final statusCode
 | 
					    console.log('statusCode:', response.statusCode); // The final statusCode
 | 
				
			||||||
    console.log('Body Length:', body.length); // body length
 | 
					    console.log('Body Length:', body.length); // body length
 | 
				
			||||||
 | 
					    console.log('Response:', response.toJSON()); // body length
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								index.js
									
									
									
									
									
								
							@ -82,7 +82,7 @@ function setDefaults(defs) {
 | 
				
			|||||||
      resp.request = req;
 | 
					      resp.request = req;
 | 
				
			||||||
      resp.request.uri = url.parse(opts.url);
 | 
					      resp.request.uri = url.parse(opts.url);
 | 
				
			||||||
      //resp.request.method = opts.method;
 | 
					      //resp.request.method = opts.method;
 | 
				
			||||||
      resp.request.headers = opts.headers;
 | 
					      resp.request.headers = finalOpts.headers;
 | 
				
			||||||
      resp.request.toJSON = toJSONifier([ 'uri', 'method', 'headers' ]);
 | 
					      resp.request.toJSON = toJSONifier([ 'uri', 'method', 'headers' ]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (followRedirect && resp.headers.location && -1 !== [ 301, 302 ].indexOf(resp.statusCode)) {
 | 
					      if (followRedirect && resp.headers.location && -1 !== [ 301, 302 ].indexOf(resp.statusCode)) {
 | 
				
			||||||
@ -267,7 +267,7 @@ function setDefaults(defs) {
 | 
				
			|||||||
      // generally uploads don't use Chunked Encoding (some systems have issues with it)
 | 
					      // generally uploads don't use Chunked Encoding (some systems have issues with it)
 | 
				
			||||||
      // and I don't want to do the work to calculate the content-lengths. This seems to work.
 | 
					      // and I don't want to do the work to calculate the content-lengths. This seems to work.
 | 
				
			||||||
      req = form.submit(finalOpts, function (err, resp) {
 | 
					      req = form.submit(finalOpts, function (err, resp) {
 | 
				
			||||||
        if (err) { cb(err); }
 | 
					        if (err) { cb(err); return; }
 | 
				
			||||||
        onResponse(resp);
 | 
					        onResponse(resp);
 | 
				
			||||||
        resp.resume();
 | 
					        resp.resume();
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user