Sie eine POST-Anfrage in Eckige 2 mit JSON Körper

Ich bin einige POST-Anforderungen mit POSTBOTEN wie folgt:

Sie eine POST-Anfrage in Eckige 2 mit JSON Körper

Dies ist mit POSTBOTEN und es funktioniert Prima. Auch vom POSTBOTEN

POST /supervisor/stop/process HTTP/1.1
Host: bento
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 66b05631-8b4e-473a-9d3f-deaa544ecac6

{
"ip" : "192.168.1.115",
"port" : "9001",
"process" : "public_video_convert:video_convert_01"
}

Habe ich versucht die gleiche Sache mit Winkel-2 wie folgt:

let url = "http://bento/supervisor/stop/process";
        let data = {
            "ip": "192.168.1.115",
            "port": "9001",
            "process": "public_video_convert:video_convert_01"
        }
        let body = JSON.stringify(data);
        let head = new Headers({
            'Content-Type': 'application/json'
        });

        this.http.post(url, body, {headers : head})
            .map(res =>  res.json())
            .subscribe(
                data => {console.log(data);},
                err => console.log(err),
                () => console.log('Fetching complete for Server Metrics')
            );

Wenn ich diesen starte, bekomme ich eine 405 Method Not Allowed

Den details der Anfrage und der Antwort vom dev-tools ist wie folgt:

Sie eine POST-Anfrage in Eckige 2 mit JSON Körper

Ich bin nicht sicher, wie Sie damit umgehen können.

  • Ich denke, die PreFlight Anfrage fehlschlägt. Tun Sie den server Steuern? HTTP OPTIONS reqyests wurde möglicherweise nicht aktiviert es.
InformationsquelleAutor kosta | 2016-02-23
Schreibe einen Kommentar