obj instanceof http.IncomingMessage hard to create tests for
Open
Feature Requests
Needs More Info
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 161
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/caolan/forms/blob/fbb4e5dc6ff93a6e8d89480aff7e278f87403915/lib/forms.js#L71
} else if (obj instanceof http.IncomingMessage) {
that line requires that you really have an instanceof http.IncomingMessage which is not really easy to create in a mock, and then randomly the code runs differently, even though you are pass something that looks very very similar to a request ;)
maybe replace with something like:
} else if (obj.body && obj.method && (obj.method === 'POST' || obj.method === 'PUT')) {
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.