Skip to content

Wrong indentation in nodejs-axios when body type is urlencoded #445

@webholik

Description

@webholik

Describe the bug
When the body type isx-www-form-urlencoded, the generated Axios code has wrong indentation.

To Reproduce
Choose body as x-www-form-urlencoded and enter at least two key-value pairs.
The output is:

var data = qs.stringify({
 'hello': 'world',
'this': 'that' 
});

Expected code snippet and corresponding request

var data = qs.stringify({
    'hello': 'world',
    'this': 'that' 
});

Screenshots
Screenshot 2021-01-20 at 5 40 09 PM

Additional context
This is the offending line in codegens/nodejs-axios/lib/parseRequest.js:

bodySnippet += ` data = qs.stringify({\n ${dataArray.join(',\n')} \n});`;

We are not doing any indentation at all.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions