I
I
Ivan-P2017-05-25 10:01:01
symfony
Ivan-P, 2017-05-25 10:01:01

How to send PUT x-www-form-urlencoded in Angular 2?

Good afternoon.
I have such a problem that I need to send a simple PUT request from the Angular 2 front with one {key: value} pair to the back written in Symfony. But I constantly get 404. All I could get from the back-developer is a screenshot from Postman:
6384176dc1b14a17b8f0f9bbf64aa072.jpg
But no matter what manipulations I do with sending a request, I get only 404.

send(url) {
    let headers = new Headers({'Content-Type': 'application/x-www-form-urlencoded'});
    let options = new RequestOptions({ headers: headers });

    let data = 'url=' + encodeURIComponent(url);
    let data2 = {url: url};

    return this.http.put(`${this.apiUrl}`, data);
  }

if I send data or data2 I get OPTIONS 200 and PUT 404 and if I add 3 as the options parameter, then OPTIONS falls from 404.
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question