How can you set default headers for every request made by HttpClient in your application?
- By adding headers to each HttpClient request manually
- By configuring HttpHeaders globally
- By modifying the HttpClient constructor
- By using an interceptor
You can set default headers for all HttpClient requests by using an interceptor. Interceptors allow you to intercept outgoing requests and modify them, including adding default headers, before they are sent.
Loading...
Related Quiz
- Which of the following is NOT a valid RxJS operator commonly used in Angular?
- To ensure that Angular recognizes your custom component's value accessor to interact with the ngModel directive, you need to add it to the providers array of your component and associate it with the ______ token.
- The tick function is provided by the ______ testing utility to simulate the passage of time in tests.
- What is the significance of the RouterLinkActive directive?
- In Angular's reactive forms, the method used to mark a control as touched is called ______.