Skip to content

Commit 597225e

Browse files
author
dhwaneetbhatt
committed
Evaluate followOriginalHttpMethod to true if either request or options are true
1 parent dfac7ce commit 597225e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

codegens/curl/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ self = module.exports = {
244244
id: 'followOriginalHttpMethod',
245245
type: 'boolean',
246246
default: false,
247-
description: 'Use the original HTTP method when following redirects'
247+
description: 'Redirect with the original HTTP method instead of the default behavior of redirecting with GET'
248248
},
249249
{
250250
name: 'Trim request body fields',

codegens/curl/lib/util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ var self = module.exports = {
223223

224224
if (body.mode === 'formdata' || body.mode === 'urlencoded') {
225225
let memberCount = 0;
226-
body[body.mode].members && body[body.mode].members.forEach((param) => {
226+
body[body.mode] && body[body.mode].members && body[body.mode].members.forEach((param) => {
227227
if (!param.disabled) {
228228
memberCount += 1;
229229
}
@@ -245,7 +245,7 @@ var self = module.exports = {
245245
*/
246246
shouldAddHttpMethod: function (request, options) {
247247
const followOriginalHttpMethod =
248-
_.get(request, 'protocolProfileBehavior.followOriginalHttpMethod', options.followOriginalHttpMethod),
248+
options.followOriginalHttpMethod || _.get(request, 'protocolProfileBehavior.followOriginalHttpMethod', false),
249249
disableBodyPruning = _.get(request, 'protocolProfileBehavior.disableBodyPruning', true),
250250
isBodyEmpty = self.isBodyEmpty(request.body);
251251

test/codegen/structure.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const expectedOptions = {
6161
name: 'Follow original HTTP method',
6262
type: 'boolean',
6363
default: false,
64-
description: 'Use the original HTTP method when following redirects'
64+
description: 'Redirect with the original HTTP method instead of the default behavior of redirecting with GET'
6565
},
6666
trimRequestBody: {
6767
name: 'Trim request body fields',

0 commit comments

Comments
 (0)