Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure formData value is not undefined #3097

Closed
wants to merge 1 commit into from

Conversation

fijimunkii
Copy link

PR Checklist:

  • I have run npm test locally and all tests are passing.
  • I have added/updated tests for any new behavior. (there is a test for null exception, there was none for undefined)
  • If this is a significant change, an issue has already been created where the problem / solution was discussed: [ Ignore null and undefined values on processing formData #3063 ]

PR Description

One must be careful that all formData values are not undefined

An undefined value in form-data append will cause a confusing error:
TypeError: Cannot read property 'name' of undefined

Simple fix here is casting to empty string when value is undefined

To repro:

var formData = { woops: undefined };
var request = require('request');
request('https://github.com', { formData }, console.log)

Related PR to fix form-data form-data/form-data#417

One must be careful that all formData values are not undefined

An undefined value in form-data append will cause a confusing error:
`TypeError: Cannot read property 'name' of undefined`

Simple fix here is casting to empty string

To repro:
```js
var formData = { woops: undefined };
var request = require('request');
request('https://github.com', { formData }, console.log)
```

Related PR to fix form-data form-data/form-data#417
@stale
Copy link

stale bot commented Jan 26, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 26, 2020
@stale stale bot closed this Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant