# HTTP put request error

**URL:** https://meta.discourse.org/t/http-put-request-error/101604
**Category:** Development
**Created:** [November 8, 2018, 12:15pm UTC](https://meta.discourse.org/t/http-put-request-error/101604 "2018-11-08T12:15:53Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Edwin\_Mhoy\_Silva](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/edwin_mhoy_silva/32/109980_2.png) [@Edwin\_Mhoy\_Silva](https://meta.discourse.org/u/Edwin_Mhoy_Silva)
#### Post date: [November 8, 2018, 12:15pm UTC](https://meta.discourse.org/t/http-put-request-error/101604/1 "2018-11-08T12:15:53Z")

</div>

I’m having some issues with put request to my discourse from the api.  
I can make, post and get request, but when I try to make a put request it doesn’t work.  
My put request works, when I have the GOOGLE CORS extension on.

I am making api call from Angular **localhost:4200.**  
I enable CORS inside the discourse management, which work fine with my other request, just not for my put request.

 ![51](https://global.discourse-cdn.com/meta/original/3X/2/c/2c8c66a26e8eb10ab388d7ec2234c2ee73c5532a.png)

This is my error:

 ![38](https://global.discourse-cdn.com/meta/original/3X/3/e/3e8c5a14b526ec28fb201974a52c5de8d2e19ce4.png)

This is the header which I use

 ![12](https://global.discourse-cdn.com/meta/original/3X/4/2/4211fc4524b352be32856318ab86e5e1c8905178.png)  
And this is my method, which does not work when I don’t use the google chrome extension

```plaintext
  addAboutCompetition(postId, dataForm) {

    const competitionForm = dataForm.value;
    const prize = competitionForm.competitionPrize;
    const description = competitionForm.competitionDescription;
    const endDate = competitionForm.competitionEndDate;
    console.log(endDate);
    const aboutText = '|type|normal|type| |endeDate|' + endDate + '|endeDate| |winner|false-/-null-/-none-/-avatar-/' +
      '-name-/-username|winner||price|' + prize + '-/p/-|price|' +
      '|text|<br><strong>UDFORDRINGEN</strong><br>' + description + '|text|';

    const data = new FormData();
    data.append('api_key', WLIApiKey);
    data.append('api_username', WLIUsername);
    data.append('post[raw]', aboutText);

    return this.http.put(url + '/posts/' + postId, data, {
      headers
    });
  }

```

I think it has something to do with my header maybe ?

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [November 12, 2018, 4:54pm UTC](https://meta.discourse.org/t/http-put-request-error/101604/3 "2018-11-12T16:54:33Z")

</div>

This is fixed by this commit made on Sept 17:

[https://github.com/discourse/discourse/commit/f3214889dcf4391e397b6f81863182cf678482e5](https://github.com/discourse/discourse/commit/f3214889dcf4391e397b6f81863182cf678482e5)

which is not available on Discourse stable yet.

---

<div class="post-metadata">

### Author: ![Edwin\_Mhoy\_Silva](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/edwin_mhoy_silva/32/109980_2.png) [@Edwin\_Mhoy\_Silva](https://meta.discourse.org/u/Edwin_Mhoy_Silva)
#### Post date: [November 12, 2018, 5:16pm UTC](https://meta.discourse.org/t/http-put-request-error/101604/4 "2018-11-12T17:16:46Z")

</div>

Thanks for the @RGJ. This seems to be the problem I’m facing.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [November 13, 2018, 3:56am UTC](https://meta.discourse.org/t/http-put-request-error/101604/5 "2018-11-13T03:56:44Z")

</div>

Simply update to latest and you’ll be good.

---

<div class="post-metadata">

### Author: ![Edwin\_Mhoy\_Silva](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/edwin_mhoy_silva/32/109980_2.png) [@Edwin\_Mhoy\_Silva](https://meta.discourse.org/u/Edwin_Mhoy_Silva)
#### Post date: [November 13, 2018, 5:58am UTC](https://meta.discourse.org/t/http-put-request-error/101604/6 "2018-11-13T05:58:56Z")

</div>

Is the latest stable yet?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [November 13, 2018, 6:01am UTC](https://meta.discourse.org/t/http-put-request-error/101604/7 "2018-11-13T06:01:20Z")

</div>

Latest is always stable 💪
