I need to set some Authorization headers after the user has logged in, for every subsequent request.
To set headers for a particular request,
I has able to choose a simplier solution > Add a new Headers to the defaults options merge or load by your api get (or other) function.
get(endpoint: string, params?: any, options?: RequestOptions) {
if (!options) {
options = new RequestOptions();
options.headers = new Headers( { "Accept": "application/json" } ); <<<<
}
// [...]
}
Of course you can externalize this Headers in default options or whatever in your class. This is in the Ionic generated api.ts @Injectable() export class API {}
It is very quick and it work for me. I didn't want json/ld format.