1111 * @license MIT
1212 */
1313
14- var Url = require ( "url" ) ,
15- spawn = require ( "child_process" ) . spawn ,
16- fs = require ( 'fs' ) ;
14+ var Url = require ( "url" )
15+ , spawn = require ( "child_process" ) . spawn
16+ , fs = require ( 'fs' ) ;
1717
1818exports . XMLHttpRequest = function ( ) {
1919 /**
@@ -402,7 +402,7 @@ exports.XMLHttpRequest = function() {
402402 fs . writeFileSync ( syncFile , "" , "utf8" ) ;
403403 // The async request the other Node process executes
404404 var execString = "var http = require('http'), https = require('https'), fs = require('fs');"
405- + "var doRequest = http" + ( ssl ? "s" : "" ) + ".request;"
405+ + "var doRequest = http" + ( ssl ? "s" : "" ) + ".request;"
406406 + "var options = " + JSON . stringify ( options ) + ";"
407407 + "var responseText = '';"
408408 + "var req = doRequest(options, function(response) {"
@@ -430,7 +430,7 @@ exports.XMLHttpRequest = function() {
430430 syncProc . stdin . end ( ) ;
431431 // Remove the temporary file
432432 fs . unlinkSync ( syncFile ) ;
433- if ( self . responseText . match ( / ^ N O D E - X M L H T T P R E Q U E S T - E R R O R : / ) ) {
433+ if ( self . responseText . match ( / ^ N O D E - X M L H T T P R E Q U E S T - E R R O R : / ) ) {
434434 // If the file returned an error, handle it
435435 var errorObj = self . responseText . replace ( / ^ N O D E - X M L H T T P R E Q U E S T - E R R O R : / , "" ) ;
436436 self . handleError ( errorObj ) ;
@@ -443,6 +443,9 @@ exports.XMLHttpRequest = function() {
443443 }
444444 } ;
445445
446+ /**
447+ * Called when an error is encountered to deal with it.
448+ */
446449 this . handleError = function ( error ) {
447450 this . status = 503 ;
448451 this . statusText = error ;
0 commit comments