mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge branch 'pr_2078' into dev
This commit is contained in:
@@ -203,28 +203,32 @@ module.exports = function(RED) {
|
||||
var payload = null;
|
||||
|
||||
if (method !== 'GET' && method !== 'HEAD' && typeof msg.payload !== "undefined") {
|
||||
if (typeof msg.payload === "string" || Buffer.isBuffer(msg.payload)) {
|
||||
payload = msg.payload;
|
||||
} else if (typeof msg.payload == "number") {
|
||||
payload = msg.payload+"";
|
||||
if (opts.headers['content-type'] == 'multipart/form-data' && typeof payload === "object") {
|
||||
opts.formData = msg.payload;
|
||||
} else {
|
||||
if (opts.headers['content-type'] == 'application/x-www-form-urlencoded') {
|
||||
payload = querystring.stringify(msg.payload);
|
||||
if (typeof msg.payload === "string" || Buffer.isBuffer(msg.payload)) {
|
||||
payload = msg.payload;
|
||||
} else if (typeof msg.payload == "number") {
|
||||
payload = msg.payload+"";
|
||||
} else {
|
||||
payload = JSON.stringify(msg.payload);
|
||||
if (opts.headers['content-type'] == null) {
|
||||
opts.headers[ctSet] = "application/json";
|
||||
if (opts.headers['content-type'] == 'application/x-www-form-urlencoded') {
|
||||
payload = querystring.stringify(msg.payload);
|
||||
} else {
|
||||
payload = JSON.stringify(msg.payload);
|
||||
if (opts.headers['content-type'] == null) {
|
||||
opts.headers[ctSet] = "application/json";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (opts.headers['content-length'] == null) {
|
||||
if (Buffer.isBuffer(payload)) {
|
||||
opts.headers[clSet] = payload.length;
|
||||
} else {
|
||||
opts.headers[clSet] = Buffer.byteLength(payload);
|
||||
if (opts.headers['content-length'] == null) {
|
||||
if (Buffer.isBuffer(payload)) {
|
||||
opts.headers[clSet] = payload.length;
|
||||
} else {
|
||||
opts.headers[clSet] = Buffer.byteLength(payload);
|
||||
}
|
||||
}
|
||||
opts.body = payload;
|
||||
}
|
||||
opts.body = payload;
|
||||
}
|
||||
|
||||
if (method == 'GET' && typeof msg.payload !== "undefined" && paytoqs) {
|
||||
|
Reference in New Issue
Block a user