connect-rest
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -68,3 +68,3 @@ /* | ||
action(request, content, function(err, result, resOptions){ | ||
callback(err, { contentType: options.contentType || 'application/json', result : result, resOptions: resOptions || {} } ); | ||
callback(err, { contentType: options.contentType, result : result, resOptions: resOptions || {} } ); | ||
}); | ||
@@ -74,3 +74,3 @@ } else { | ||
var err; | ||
callback( err, { contentType: options.contentType || 'application/json', result : result, resOptions: {} } ); | ||
callback( err, { contentType: options.contentType, result : result, resOptions: {} } ); | ||
} | ||
@@ -125,2 +125,4 @@ }, _ | ||
} else { | ||
if( !result.contentType ) | ||
result.contentType = 'application/json'; | ||
var headers = result.resOptions.headers || { }; | ||
@@ -179,2 +181,9 @@ if( !headers['Content-Type'] ) | ||
if( isReadableStream( result.result ) ){ | ||
result.result.on('open', function () { | ||
var headers = result.resOptions.headers || { }; | ||
if( !headers['Content-Type'] && result.contentType ){ | ||
headers['Content-Type'] = result.contentType; | ||
} | ||
res.writeHead( result.resOptions.statusCode || 200, headers ); | ||
}); | ||
result.result.on('error',function( error ){ | ||
@@ -181,0 +190,0 @@ returnResult( error, null, res ); |
{ | ||
"name": "connect-rest", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Exceptionally featureful RESTful web services middleware for Connect.", | ||
@@ -57,3 +57,3 @@ "keywords": [ | ||
}, | ||
"_id": "connect-rest@1.2.1" | ||
"_id": "connect-rest@1.2.2" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4979042
1185