Basically this http put will act like a button and switch on a system. On postman, i can just input the URL and it works fine, but when i try to implement it on Ionic App, it doesnt do anything. (Sorry if the codes is unclear)
The following is the HTTP code generated by POSTMAN
PUT (......) HTTP/1.1
Host: ip
Cache-Control: no-cache
Postman-Token: 0bad8e4d-e717-015a-e321-d2ee05acc563
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Any Idea how do i implement in an Ionic Angular 4 Application?
data: any;
toggle(): Observable<Response> {
let headers = new Headers({ 'Content-Type': 'multipart/form-data' });
let options = new RequestOptions({headers: headers});
return this.http.put('http:/ip/......', JSON.stringify(this.data), options).
map((res:Response) => res.json()).catch((error:any) => Observable.throw(error.json().error || 'Server error'));
}
There is actually no error whatsoever, but just that nothing happens.