wreck
Advanced tools
Comparing version 7.0.1 to 7.0.2
@@ -91,10 +91,15 @@ 'use strict'; | ||
uri.method = method.toUpperCase(); | ||
uri.headers = options.headers; | ||
uri.headers = options.headers || {}; | ||
const hasContentLength = Object.keys(uri.headers).some((key) => { | ||
return key.toLowerCase() === 'content-length'; | ||
}); | ||
const payloadSupported = (uri.method !== 'GET' && uri.method !== 'HEAD' && options.payload !== null && options.payload !== undefined); | ||
if (payloadSupported && | ||
(typeof options.payload === 'string' || Buffer.isBuffer(options.payload))) { | ||
(typeof options.payload === 'string' || Buffer.isBuffer(options.payload)) && | ||
(!hasContentLength)) { | ||
uri.headers = Hoek.clone(uri.headers) || {}; | ||
uri.headers['Content-Length'] = Buffer.isBuffer(options.payload) ? options.payload.length : Buffer.byteLength(options.payload); | ||
uri.headers = Hoek.clone(uri.headers); | ||
uri.headers['content-length'] = Buffer.isBuffer(options.payload) ? options.payload.length : Buffer.byteLength(options.payload); | ||
} | ||
@@ -101,0 +106,0 @@ |
{ | ||
"name": "wreck", | ||
"description": "HTTP Client Utilities", | ||
"version": "7.0.1", | ||
"version": "7.0.2", | ||
"repository": "git://github.com/hapijs/wreck", | ||
@@ -16,4 +16,4 @@ "main": "lib/index", | ||
"dependencies": { | ||
"boom": "3.1.x", | ||
"hoek": "3.0.x" | ||
"boom": "3.x.x", | ||
"hoek": "3.x.x" | ||
}, | ||
@@ -20,0 +20,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
133444
1908
+ Addedboom@3.2.2(transitive)
- Removedboom@3.1.3(transitive)
Updatedboom@3.x.x
Updatedhoek@3.x.x