Bad request http post angle request

0

When performing a http post request, I'm getting:

Object {headers: {...}, status: 400, statusText: "Bad Request", url: " link ", ok: false, name: "HttpErrorResponse", message: "Http failure response for link 400 Bad Request", error: {...}}

My service that sends the post:

  pesquisaEmail(email): Observable<any>{
    let headers = new HttpHeaders();
    headers = headers.set('Content-Type', 'application/json; charset=utf-8');
    headers.append('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
    this.token = localStorage.getItem('currentUser');

    return this._http.post<any>(AppSettings.API_ENDPOINT_EMAIL,
      {email: email,
      token_jc: this.token },
      { headers: headers, observe: 'response' })
        .pipe(
          map((response) => ({data: response.body, status: response.status}))
        )}

My backend api expects an email key with the email and another token key with a token value that is stored in the localstorage. Why am I getting a bad request?

    
asked by anonymous 09.07.2018 / 18:10

0 answers