Skip to content
This repository was archived by the owner on Sep 9, 2022. It is now read-only.

Commit 93c7677

Browse files
committed
Update README.md
1 parent 2598062 commit 93c7677

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ Drop-in module for ASP.Net WebAPI that enables `GZip` and `Deflate` support
55

66

77
### How to use
8-
**Server side**:
8+
**Server side**
99
You need to add the compression handler as the last applied message handler on outgoing requests, and the first one on incoming requests.
1010
To do that, just add the following line to your `App_Start\WebApiConfig.cs` file after adding all your other message handlers:
1111
```csharp
12-
config.MessageHandlers.Insert(0, new CompressionHandler(new GZipCompressor(), new DeflateCompressor()));
12+
GlobalConfiguration.Configuration.MessageHandlers.Insert(0, new CompressionHandler(new GZipCompressor(), new DeflateCompressor()));
1313
```
14-
This will insert the `CompressionHandler` to the request pipeline as the first one on incoming requests, and the last one on outgoing requests.
14+
This will insert the `CompressionHandler` to the request pipeline as the first on incoming requests, and the last on outgoing requests.
1515

16-
**Client side**:
16+
**Client side**
1717
You need to apply the following code when creating your `HttpClient`:
1818
```csharp
1919
var client =
@@ -22,4 +22,6 @@ var client =
2222

2323
client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
2424
client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("deflate"));
25-
```
25+
```
26+
27+
Thats it! You should now immediately start experiencing smaller payloads when doing GET, POST, PUT, etc.

0 commit comments

Comments
 (0)