You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It'll then send an HTTP `GET` request to the `/echo/<a-random-string>` endpoint. In the request, it'll include an Accept-Encoding header set to multiple values, like: `Accept-Encoding: encoding-1, gzip, encoding-2`.
741
-
One of the values in the list will be `gzip`, but the other values will be invalid encoding names.
739
+
For this extension, assume that your server only supports the `gzip` compression scheme.
742
740
743
-
As an example, here's a request you might receive:
741
+
For this stage, you don't need to compress the body. You'll implement compression in a later stage.
744
742
743
+
### Tests
744
+
745
+
The tester will execute your program like this:
745
746
```
746
-
GET /echo/foo HTTP/1.1
747
-
Host: localhost:4221
748
-
User-Agent: curl/7.64.1
749
-
Accept-Encoding: encoding-1, gzip, encoding-2
747
+
$ ./your_server.sh
750
748
```
751
749
752
-
Your server must respond with a `200 OK` response. The response should have a `Content-Encoding: gzip` header present. The response body will not be tested in this stage. (We will tackle the actual compression in a later stage)
753
-
Here's the response you're expected to send back:
750
+
The tester will then send two `GET` requests to the `/echo/{str}` endpoint on your server.
751
+
752
+
#### First request
754
753
754
+
For the first request, the `Accept-Encoding` header will contain `gzip`, along with some invalid encodings:
Your server's response must contain this header: `Content-Encoding: gzip`.
760
+
```javascript
756
761
HTTP/1.1 200 OK
757
-
Content-Encoding: gzip
758
762
Content-Type: text/plain
759
-
Content-Length: 3
763
+
Content-Encoding: gzip
760
764
761
-
foo
765
+
// Body omitted.
762
766
```
763
767
764
-
It'll then send another HTTP `GET` request to the `/echo/<a-random-string>` endpoint. In the request, it'll include an Accept-Encoding header like: `Accept-Encoding: encoding-1, encoding-2`.
765
-
But this time the Accept-Encoding header will not contain gzip, it'll only contain invalid values (i.e. encodings that your server doesn't support).
766
-
As an example, here's a request you might receive:
768
+
#### Second request
767
769
770
+
For the second request, the `Accept-Encoding` header will only contain invalid encodings:
Your server must respond with a `200 OK` response. The response should NOT have a `Content-Encoding` header present. The response body will not be tested in this stage.
776
-
Here's the response you're expected to send back:
777
-
778
-
```
775
+
Your server's response must not contain a `Content-Encoding` header:
776
+
```javascript
779
777
HTTP/1.1 200 OK
780
778
Content-Type: text/plain
781
-
Content-Length: 3
782
779
783
-
bar
780
+
// Body omitted.
784
781
```
785
-
786
-
### Notes
787
-
788
-
1. Header names are case-insensitive, i.e. `accept-encoding: gzip` and `Accept-Encoding: gzip` are equivalent. We won't test this explicitly in this challenge, but it's a good practice to lowercase your header names before comparison.
789
782
marketing_md: |
790
783
In this stage, you'll add support for reading multiple compression values from `Accept-Encoding` header sent by clients, and respond with `Content-Encoding` header in your response.
0 commit comments