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.

send multipart/form-data insteadof x-www-form-urlencoded.

See original GitHub issue

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ x ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

    let params = new FormData();
    for (let key in options) {
      params.append(key, options[key]);
    }

    const headers = new HttpHeaders();
    headers.set(
      "Content-Type",
      "application/x-www-form-urlencoded;"
    );
    return this.http.post(url, params, { headers });

look to browser to find the request param:

Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryEjmSsnYOjN4jCZRK

Expected behavior

the request content-type should be

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

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment


Angular version: X.Y.Z

```
ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 6.2.4
Node: 10.10.0
OS: linux x64
Angular: 6.1.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.8.4
@angular-devkit/build-angular     0.8.4
@angular-devkit/build-optimizer   0.8.4
@angular-devkit/build-webpack     0.8.4
@angular-devkit/core              0.8.4
@angular-devkit/schematics        0.8.4
@angular/cli                      6.2.4
@ngtools/webpack                  6.2.4
@schematics/angular               0.8.4
@schematics/update                0.8.4
rxjs                              6.2.2
typescript                        2.9.2
webpack                           4.20.2
```

Browser:
- [ x ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
calidioncommented, Oct 12, 2018

@alxhub

Do you have any test case to prove that you are right before you close this issue?

0reactions
angular-automatic-lock-bot[bot]commented, Sep 14, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

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 ...
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 ...
Read more >
Difference between application/x-www-form-urlencoded and ...
3) Both content types are used while sending form data as a POST request. 4) The x-www-form-urlencoded is used more generally to send...
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...
Read more >
Send Data by Using a POST Method - Micro Focus
The application/x-www-form-urlencoded content type describes form data that is sent in a single block in the HTTP message body. Unlike the query part...
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