This repository was archived by the owner on Sep 9, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff 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**
99You need to add the compression handler as the last applied message handler on outgoing requests, and the first one on incoming requests.
1010To 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**
1717You need to apply the following code when creating your ` HttpClient ` :
1818``` csharp
1919var client =
@@ -22,4 +22,6 @@ var client =
2222
2323client .DefaultRequestHeaders .AcceptEncoding .Add (new StringWithQualityHeaderValue (" gzip" ));
2424client .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.
You can’t perform that action at this time.
0 commit comments