Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49308

Ionic2 frame work sending empty parameters in http post(400 Badrequest)

$
0
0

@shalini_99 wrote:

Method is working fine in postman but, while sending the same request from ionic2 is generating an error.Get methods were working fine but there is some issue in post.The request is sending empty parameters in post and generating error 400 Bad request.

Login.ts

onlogin()
{

let login_email="vvvv@gmail.com";
let login_password="123456"
this.body={
login_email:login_email,
login_password:login_password
};

this.auth.login(this.body).subscribe(data => {
this.result = data

console.log(data);
});

}

authservice.ts

login(param)
{
let headers = new Headers({ 'Content-Type': 'application/json'});
let options = new RequestOptions({ headers: headers });
return this.http.post(this.apiUrl+'/login',JSON.stringify(param),options)
.map((res: Response) => {
if (res) {
return { status: res.status, json: res.json() }
}
});
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49308

Trending Articles