File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ http.createServer(function(request, response) {
2222 else
2323 response . end ( data . body ) ;
2424 } , function ( error ) {
25- response . writeHead ( 500 , error . toString ( ) ) ;
25+ response . writeHead ( 500 ) ;
26+ response . end ( error . toString ( ) ) ;
2627 console . log ( "Response failed: " , error . stack ) ;
2728 } ) ;
2829} ) . listen ( 8000 ) ;
@@ -31,8 +32,8 @@ function respondTo(request) {
3132 if ( request . method in methods )
3233 return methods [ request . method ] ( urlToPath ( request . url ) , request ) ;
3334 else
34- return { code : 405 ,
35- body : "Method " + request . method + " not allowed." } ;
35+ return Promise . resolve ( { code : 405 ,
36+ body : "Method " + request . method + " not allowed." } ) ;
3637}
3738
3839function urlToPath ( url ) {
@@ -51,7 +52,7 @@ var fsp = {};
5152} ) ;
5253
5354// Since several functions need to call `fsp.stat` and handle failures
54- // that indicate non-existant files in a special way, this is a
55+ // that indicate non-existent files in a special way, this is a
5556// convenience wrapper that converts file-not-found failures into
5657// success with a null value.
5758//
You can’t perform that action at this time.
0 commit comments