feedback
feedback copied to clipboard
[Bug]: Axios request snippet badly generated with Form URL-Enconded
What happened?
When the Request created is using Form URL-Encoded body type, the Javascript Axios code is badly generated. The code generated will be using JSON body type instead of the correct one. In fact, the code generated when JSON body type is selected is the same.
Steps to reproduce?
- Create a POST request
- In the body tab, select Form URL-Encoded type
- Add some parameters in the body
- Click in the snippet code generation for Javascript Axios
- The code generated will be like this:
import axios from "axios";
const options = {
method: 'POST',
url: 'https://url.com',
data: {
grant_type: 'authorization_code',
code: 'code',
redirect_uri: 'http://localhost/'
}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
- If you run the code, you will see that the request
content-typeisapplication/json
VS Code version
1.70.0
Extension version
v1.4.1
Relevant log output
No response