angular / in-memory-web-api

The code for this project has moved to the angular/angular repo. This repo is now archived.
MIT License
1.18k stars 232 forks source link

Content-Type and Authorization set failed #194

Open coolara opened 6 years ago

coolara commented 6 years ago

const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json', 'Authorization': 'my-auth-token' }) }; return this.http.post(url, body,httpOptions)

wardbell commented 6 years ago

This seems like a bug to me. I'm sorry I haven't been back here to see your report in so long.

I cannot understand why the headers on RequestInfo are other than the headers from the original req, supplemented with the 'Content-Type': 'application/json' header. I believe that was the original intention.

The original headers ARE preserved in RequestInfo.req.headers. You can work around with those.

I hope to fix it soon.