G
G
Galdar Turin2020-06-22 17:09:18
Angular
Galdar Turin, 2020-06-22 17:09:18

How to send a valid header request via HttpClient?

Good afternoon, I'm sitting and I can not understand why the answer comes with an error. Already that only you can google everywhere the same answer. You need to send a post request with data and a specific header. Maybe someone knows how to solve the problem)?

Screen request

5ef0baa8b15fe430103276.png

Answer screen

5ef0baaf271c6029719076.png


Request code

requestData(): Observable<Object> {
    
    let header = new HttpHeaders({
      'Content-Type': 'application/json; charset=UTF-8'
    })

    return this.http.post('https://api3',
      { 
        "login": "",
        "pass": ""
      },
      {
        headers: header
      }
    )
  }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question