@@ -63,7 +63,7 @@ module.exports = function (RED) {
63
63
} ;
64
64
reqOpts . method = config . method . toUpperCase ( ) || "GET" ;
65
65
if ( config . method === "use" && msg . method != null ) {
66
- reqOpts = msg . method . toUpperCase ( ) ;
66
+ reqOpts . method = msg . method . toUpperCase ( ) ;
67
67
}
68
68
69
69
reqOpts . headers = msg . headers ;
@@ -98,7 +98,7 @@ module.exports = function (RED) {
98
98
_send ( data ) ;
99
99
} else if ( contentFormat === "text/plain" || configContentFormat === "text/plain" ) {
100
100
_send ( data . toString ( ) ) ;
101
- } else if ( contentFormat . startsWith ( "application/" ) && contentFormat . endsWith ( "json" ) ) {
101
+ } else if ( contentFormat . startsWith ( "application/" ) && contentFormat . includes ( "json" ) ) {
102
102
try {
103
103
_send ( JSON . parse ( data . toString ( ) ) ) ;
104
104
} catch ( error ) {
@@ -109,7 +109,7 @@ module.exports = function (RED) {
109
109
} ) ;
110
110
node . error ( error . message ) ;
111
111
}
112
- } else if ( contentFormat . startsWith ( "application/" ) && contentFormat . endsWith ( "cbor" ) ) {
112
+ } else if ( contentFormat . startsWith ( "application/" ) && contentFormat . includes ( "cbor" ) ) {
113
113
cbor . decodeAll ( data , function ( error , data ) {
114
114
if ( error ) {
115
115
node . error ( error . message ) ;
@@ -144,7 +144,7 @@ module.exports = function (RED) {
144
144
var payload ;
145
145
146
146
if ( reqOpts . method !== "GET" ) {
147
- payload = _constructPayload ( msg , config [ "content-format "] ) ;
147
+ payload = _constructPayload ( msg , reqOpts . headers [ "Content-Format "] ) ;
148
148
} else if ( paytoqs === "query" ) {
149
149
try {
150
150
_appendQueryParams ( reqOpts , msg . payload ) ;
0 commit comments