# DELETE and PUT request response ERROR

**URL:** <https://meta.discourse.org/t/delete-and-put-request-response-error/69321>\
**Category:** Product Support\
**Created:** [September 4, 2017, 9:27am UTC](https://meta.discourse.org/t/delete-and-put-request-response-error/69321 "2017-09-04T09:27:16Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Andrey\_Veryovkin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andrey_veryovkin/32/76487_2.png) [@Andrey\_Veryovkin](https://meta.discourse.org/u/Andrey_Veryovkin)\
**Post date:** [September 4, 2017, 9:27am UTC](https://meta.discourse.org/t/delete-and-put-request-response-error/69321/1 "2017-09-04T09:27:16Z")

</div>

DELETE and PUT request response ERROR  
Method DELETE is not allowed by Access-Control-Allow-Methods in preflight response.

```
return Observable.fromPromise(new Promise((resolve, reject) => {
    let xhr = new XMLHttpRequest();

    let data = new FormData();
    data.append("api_key", user.api_key);
    data.append("api_username", user.api_username);
    data.append("post_action_type_id", topicActionsId);

    xhr.onreadystatechange = function() {
      if (xhr.readyState === 4) {
        if (xhr.status === 200) {
          resolve(JSON.parse(xhr.response));
        } else {
          reject(xhr.response);
        }
      }
    };

    xhr.open('DELETE','http://dogwelder.pocketgems.com/post_actions/' + topicId, true);
    xhr.setRequestHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, DELETE');
    xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
    xhr.setRequestHeader('Access-Control-Allow-Headers', 'Content-Type')
    xhr.send(data);
  }));

```

---

_[View the full topic](https://meta.discourse.org/t/delete-and-put-request-response-error/69321)._
