Request.multipart no longer crashes when header 'Content-type' present #715

Merged
merged 1 commit into from Nov 26, 2013

Projects

None yet

2 participants

@pastaclub
Contributor

Request.multipart used to crash when options contained a header 'Content-type' which is not purely lowercase. That is because hasHeader is case-insensitive and returns true, then the split method gets applied to undefined and crashes the application.

One could argue that headers should be spelled using only lowercase. However, mixed case headers used to work with a previous version of request, thus I suggest to incorporate this patch to ensure that legacy code does not suddenly crash after updating request.

@pastaclub pastaclub Request.multipart no longer crashes when header 'Content-type' is pre…
…sent

Request.multipart used to crash when options contained a header 'Content-type' which is not purely lowercase. That is because hasHeader is case insensitive and returns true and then the split method gets applied to undefined and crashes the application. One could argue that headers should be spelled using only lowercase. However, mixed case headers used to work with a previous version of request, thus I suggest to incorporate this patch to ensure that legacy code does not suddenly crash after updating request.
8ee21d0
@mikeal mikeal merged commit 50b2873 into request:master Nov 26, 2013

1 check passed

default The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment