freesoftwarefactory / parse-multipart

A javascript/nodejs multipart/form-data parser which operates on raw data.
MIT License
48 stars 79 forks source link

TypeError: Cannot read property 'trim' of undefined - (Python requests library) #26

Open nishat-sayyed opened 4 years ago

nishat-sayyed commented 4 years ago

I get the following error when I submit a POST request using Python's requests library

Stack: TypeError: Cannot read property 'trim' of undefined
     at process (/home/nishat/project/node_modules/parse-multipart/multipart.js:38:44)
     at Object.exports.Parse (/home/nishat/project/node_modules/parse-multipart/multipart.js:87:19)

My Python code (Client side):

path = 'input.png'
files = [('photo', open(path, 'rb')),]
r = requests.post(url, files=files)

The request generated in Python at client side looks like this:

--0f178608772b425484b9b4abc0f6e281
Content-Disposition: form-data; name="photo"; filename="input.png"

--0f178608772b425484b9b4abc0f6e281--