express-busboy
express-busboy copied to clipboard
No way of handling the 'error' event in busboy
Hi team,
There is no way of handling busboy's error event currently which is leading to global exceptions in express whenever a malformed body is passed
Eg:
If I pass \n instead of \r\n, an error is thrown
- Valid Request:
curl -k '<path>' \
-H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundary76aZhgZIDJfqZd9S' \
-H 'Accept: application/json, text/plain, */*' \
--data-raw $'------WebKitFormBoundary76aZhgZIDJfqZd9S\r\nContent-Disposition: form-data; name="file"; filename="img1.jpg"\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundary76aZhgZIDJfqZd9S--\r\n' \
--compressed
- Invalid Request:
curl -k '<path>' \
-H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundary76aZhgZIDJfqZd9S' \
-H 'Accept: application/json, text/plain, */*' \
--data-raw $'------WebKitFormBoundary76aZhgZIDJfqZd9S\nContent-Disposition: form-data; name="file"; filename="img1.jpg"\nContent-Type: image/jpeg\n\n\n------WebKitFormBoundary76aZhgZIDJfqZd9S--\n' \
--compressed
Would it be possible to expose the error event in express busboy?