无法加载资源:服务器响应状态为400()Ionic 3 android

时间:2018-10-30 11:09:10

标签: android http ionic3 httpclient

我正在使用 Ionic 3平台Android HttpClient 。我正在向服务器发送发布请求。它给了我错误。

enter image description here

正在对邮递员进行工作。

这是我的代码:

getAuthHeaders(auth: boolean = true) {
    const headers = new HttpHeaders();
    if (auth) {
      // headers.append('x-access-token', this.getTokenLocal());
    }
    // headers.append("Access-Control-Allow-Origin", "*");
    // headers.append('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT');
    headers.append('Content-Type', 'application/json');
    headers.append('Accept', 'application/json');

    return { headers: headers, withCredentials: true };
  }

  postLoginData(loginData)
  {
    return this.http.post(this.postLoginDataURL, loginData, this.getAuthHeaders()).map(res => res as any);
  }

0 个答案:

没有答案