@@ -118,6 +118,9 @@ RestClient.Request(new RequestHelper {
118
118
Uri = " https://jsonplaceholder.typicode.com/photos" ,
119
119
Method = " POST" ,
120
120
Timeout = 10 ,
121
+ Params = new Dictionary <string , string > {
122
+ { " param1" , " Query string param..." }
123
+ },
121
124
Headers = new Dictionary <string , string > {
122
125
{ " Authorization" , " Bearer JWT_token..." }
123
126
},
@@ -217,18 +220,26 @@ RestClient.Put<CustomResponse>(usersRoute + "/1", updatedUser).Then(customRespon
217
220
});
218
221
```
219
222
220
- ## Custom HTTP Headers and Options 💥
223
+ ## Custom HTTP Headers, Params and Options 💥
221
224
** HTTP Headers** , such as ` Authorization ` , can be set in the ** DefaultRequestHeaders** object for all requests
222
225
``` csharp
223
226
RestClient .DefaultRequestHeaders [" Authorization" ] = " Bearer ..." ;
224
227
```
225
228
226
- Also we can add specific options and override default headers for a request
229
+ ** Query string params** can be set in the ** DefaultRequestParams** object for all requests
230
+ ``` csharp
231
+ RestClient .DefaultRequestParams [" param1" ] = " Query string value..." ;
232
+ ```
233
+
234
+ Also we can add specific options and override default headers and params for a request
227
235
``` csharp
228
236
var currentRequest = new RequestHelper {
229
237
Uri = " https://jsonplaceholder.typicode.com/photos" ,
230
238
Headers = new Dictionary <string , string > {
231
239
{ " Authorization" , " Other token..." }
240
+ },
241
+ Params = new Dictionary <string , string > {
242
+ { " param1" , " Other value..." }
232
243
}
233
244
};
234
245
RestClient .GetArray <Photo >(currentRequest ).Then (response => {
@@ -245,9 +256,10 @@ currentRequest.DownloadedBytes; //The number of bytes of body data the system ha
245
256
currentRequest .Abort (); // Abort the request manually
246
257
```
247
258
248
- Later we can clean the default headers for all requests
259
+ Later we can clear the default headers and params for all requests
249
260
``` csharp
250
- RestClient .CleanDefaultHeaders ();
261
+ RestClient .ClearDefaultHeaders ();
262
+ RestClient .ClearDefaultParams ();
251
263
```
252
264
253
265
### Example
0 commit comments