@@ -142,7 +142,7 @@ const response = new HttpClient()
142142
143143#### Headers
144144
145- You can add multiple Headers to the request by using the ` withHeaders ` method. The ` withHeaders ` method accepts an object of key / value pairs:
145+ You can add multiple headers to the request by using the ` withHeaders ` method. The ` withHeaders ` method accepts an object of key / value pairs:
146146
147147``` typescript
148148import { HttpClient } from ' @wolfpackthatcodes/http-client' ;
@@ -155,9 +155,19 @@ const response = new HttpClient()
155155 .get (' https://api.example.local/users' );
156156```
157157
158+ Alternatively, use ` withHeader ` method to include individual headers.
159+
160+ ``` typescript
161+ import { HttpClient } from ' @wolfpackthatcodes/http-client' ;
162+
163+ const response = new HttpClient ()
164+ .withHeader (' X-Header' , ' value' )
165+ .get (' https://api.example.local/users' );
166+ ```
167+
158168##### Replace headers
159169
160- The ` replaceHeader ` method allow you to replace individual headers.
170+ The ` replaceHeaders ` method allow you to replace multiple headers. The ` replaceHeaders ` method accepts an object of key / value pairs:
161171
162172``` typescript
163173import { HttpClient } from ' @wolfpackthatcodes/http-client' ;
@@ -170,6 +180,19 @@ const response = httpClient
170180 .get (' https://api.example.local/users' );
171181```
172182
183+ Alternatively, use ` replaceHeader ` method to replace individual header.
184+
185+ ``` typescript
186+ import { HttpClient } from ' @wolfpackthatcodes/http-client' ;
187+
188+ const httpClient = new HttpClient ()
189+ .withHeaders ({ ' Content-Type' : ' application/xml' , Accept: ' application/html' })
190+
191+ const response = httpClient
192+ .replaceHeader (' Content-Type' , ' application/json' )
193+ .get (' https://api.example.local/users' );
194+ ```
195+
173196##### Define content type accepted
174197
175198You may use the ` accept ` method to specify the content type that your application is expecting in response to your request:
0 commit comments