kopia lustrzana https://github.com/c9/core
				
				
				
			properly encode string errors when accept is application/json
							rodzic
							
								
									9cc8b588c2
								
							
						
					
					
						commit
						685cf701e0
					
				|  | @ -11,7 +11,6 @@ | |||
|     }, | ||||
|     "dependencies": { | ||||
|         "acorn": ">=0.11.0", | ||||
|         "amd-loader": "", | ||||
|         "async": "^0.9.0", | ||||
|         "base64id": "~0.1.0", | ||||
|         "c9": "", | ||||
|  |  | |||
|  | @ -1,5 +1,7 @@ | |||
| "use strict"; | ||||
| 
 | ||||
| var error = require("http-error"); | ||||
| 
 | ||||
| plugin.consumes = [ | ||||
|     "connect", | ||||
|     "connect.static",  | ||||
|  | @ -78,6 +80,9 @@ function plugin(options, imports, register) { | |||
|     connect.useStart(frontdoor.middleware.jsonWriter()); | ||||
|      | ||||
|     connect.useError(function(err, req, res, next) { | ||||
|         if (typeof err == "string") | ||||
|             err = new error.InternalServerError(err); | ||||
|              | ||||
|         var statusCode = parseInt(err.code || err.status || res.statusCode, 10) || 500; | ||||
| 
 | ||||
|         if (statusCode < 400) | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Nikolai Onken
						Nikolai Onken