myshenin / aws-lambda-multipart-parser

Parser of multipart/form-data requests for AWS Lambda
MIT License
74 stars 38 forks source link

Repeated field names get overriden by the last one #23

Open RonnieWinter opened 5 years ago

RonnieWinter commented 5 years ago

I have a form where I have 3 input fields with the name attribute 'departureAirports'. I only set the first one and leave the second and third empty. When I inspect the parsed data from aws-lambda-multipart-parser, I see that departureAirports if empty and was overridden by the third departure airport.

I think the proper functionality should be, parse the first and if there are more fields with the same name, make the object attribute into a list, and push every subsequent value for the repeated fields.

So if I had the following multipart data: departureAirports: 'JFK' departureAirports: 'LAX' departureAirports: ''

I should get this as the parsed data:

{
    departureAirports: ['JFK', 'LAX', '']
}
dasheck0 commented 4 years ago

Is this fixed by now? Running into the same issue.

EDIT: For all searching still for a solution. Either use the fork of this repo or use this npm package instead: https://github.com/francismeynard/lambda-multipart-parser