anthonygauthier / axios-curlirize

axios plugin converting requests to cURL commands, saving and logging them.
MIT License
186 stars 31 forks source link

"Content-Type: undefined" when I do not set the content type #67

Closed PeterlitsZo closed 4 months ago

PeterlitsZo commented 10 months ago

When I do not set the content type, like this:

let resp = await axios.post(baseUrl + '/page/init', data, {
  headers: {
    'nuwa-wings': 'env=osim232-v',
  }
})

The generated cURL code will be like:

curl -X POST -H "Accept:application/json, text/plain, */*" -H "Content-Type:undefined" -H "nuwa-wings:env=osim232-v" ...

The package.json is:

{
  "dependencies": {
    "axios": "^1.6.2",
    "axios-curlirize": "^2.0.0",
    // etc...
  }
}
Diluka commented 5 months ago

Should omit all undefined values including params