Skip to content

Commit 0f84d23

Browse files
committed
Update README and docs
1 parent 45a0619 commit 0f84d23

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

README.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ RestClient.Request(new RequestHelper {
118118
Uri = "https://jsonplaceholder.typicode.com/photos",
119119
Method = "POST",
120120
Timeout = 10,
121+
Params = new Dictionary<string, string> {
122+
{ "param1", "Query string param..." }
123+
},
121124
Headers = new Dictionary<string, string> {
122125
{ "Authorization", "Bearer JWT_token..." }
123126
},
@@ -217,18 +220,26 @@ RestClient.Put<CustomResponse>(usersRoute + "/1", updatedUser).Then(customRespon
217220
});
218221
```
219222

220-
## Custom HTTP Headers and Options 💥
223+
## Custom HTTP Headers, Params and Options 💥
221224
**HTTP Headers**, such as `Authorization`, can be set in the **DefaultRequestHeaders** object for all requests
222225
```csharp
223226
RestClient.DefaultRequestHeaders["Authorization"] = "Bearer ...";
224227
```
225228

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
227235
```csharp
228236
var currentRequest = new RequestHelper {
229237
Uri = "https://jsonplaceholder.typicode.com/photos",
230238
Headers = new Dictionary<string, string> {
231239
{ "Authorization", "Other token..." }
240+
},
241+
Params = new Dictionary<string, string> {
242+
{ "param1", "Other value..." }
232243
}
233244
};
234245
RestClient.GetArray<Photo>(currentRequest).Then(response => {
@@ -245,9 +256,10 @@ currentRequest.DownloadedBytes; //The number of bytes of body data the system ha
245256
currentRequest.Abort(); //Abort the request manually
246257
```
247258

248-
Later we can clean the default headers for all requests
259+
Later we can clear the default headers and params for all requests
249260
```csharp
250-
RestClient.CleanDefaultHeaders();
261+
RestClient.ClearDefaultHeaders();
262+
RestClient.ClearDefaultParams();
251263
```
252264

253265
### Example

doc/RestClient.docx

-21.6 KB
Binary file not shown.

doc/RestClient.pdf

484 KB
Binary file not shown.

src/Proyecto26.RestClient/RestClient.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ public static partial class RestClient
1616
#region Common
1717

1818
/// <summary>
19-
/// Gets the version of the RestClient library.
20-
/// </summary>
21-
public static System.Version Version
19+
/// Gets the version of the RestClient library.
20+
/// </summary>
21+
public static System.Version Version
2222
{
2323
get
2424
{

0 commit comments

Comments
 (0)