question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

multipart != application/x-www-form-urlencoded

See original GitHub issue

On iOS i don’t have any problems.

Running the app for the first time on Android.

whatsapp image 2017-09-30 at 18 57 32

Two times I do a fetch:

    const data = new FormData();
    ......

    fetch('........', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      body: data
    })

Can’t find anything about this error…

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
jasonmerinocommented, Jun 8, 2018

I just ran across this same issue. I was able to get around it by changing the Content-Type header.

When I was getting the error I had:

'Content-Type': 'application/x-www-form-urlencoded'

And when I switched it to this it worked:

'Content-Type': 'multipart/form-data'

Hope this helps anyone else who runs into this issue later on.

1reaction
zeddz92commented, Jun 23, 2018

Hi, as @jasonmerino said, you have to set ‘Content-Type’: ‘multipart/form-data’ and specify the type of your file like this: const data = new FormData(); data.append('image', { uri: source, name: 'image', type: 'image/png' });

Read more comments on GitHub >

github_iconTop Results From Across the Web

application/x-www-form-urlencoded or multipart/form-data?
In HTTP there are two ways to POST data: application/x-www-form-urlencoded and multipart/form-data . I understand that most browsers are only able to upload ......
Read more >
Difference between application/x-www-form-urlencoded and ...
4) The x-www-form-urlencoded is used more generally to send text data to the server while multipart/form-data is used to send binary data, most...
Read more >
Difference Between form-data, x-www-form-urlencoded and ...
Form -data represents the data sent from website forms to APIs as part of multipart/form-data. The form-data option in Postman simulates filling ...
Read more >
POST - HTTP - MDN Web Docs
application /x-www-form-urlencoded : the keys and values are encoded in key-value ... A form using the multipart/form-data content type:.
Read more >
'x-www-form-urlencoded' or 'form-data' ? Explained in 2 mins.
form -data is a fancier way of encoding data than x-www-form-urlencoded . You can think of x-www-form-urlencoded as .txt file and form-data as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found