Today I was discussing with a colleague what’s the best options to always set some header data for your HTTP requests. Here is my solution…
Create a new TypeScript class that inherits from BaseRequestOptions:
Note: In this example I injected a LOCALE_ID to capture the culture set in the application.
Next step is to create a provider that replaces the default RequestOptions:
Last step is to register the DefaultRequestOptionsProvider in your module: