Home > Back-end >  Get full response in angular with observe: 'response' with other settings
Get full response in angular with observe: 'response' with other settings

Time:04-25

It works

return this.http.post(url, data, {observe: 'response'})

But for some reason it doesn't

let options = {
  headers: new HttpHeaders().set('Content-Type', "application/json"),
  withCredentials: true,
  observe: 'response'
}
return this.http.post(url, data, options)

Why and how i can use observe: 'response' in this case?

CodePudding user response:

you should tell exactly what's not working. I guess the typescript compiler is complaining about the type.

You can solve this like this: return this.http.post(url, data, options as any)

  • Related