Skip to content

Commit e23df8e

Browse files
committed
Updated README.md.
1 parent 2fe8d4e commit e23df8e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,19 @@ req = httpq.Request(
4444
method="GET",
4545
target="/get",
4646
protocol="HTTP/1.1",
47-
headers={"Host": "httpbin.org", "Content-Length": 12},
47+
headers={
48+
"Host": "httpbin.org",
49+
"Content-Length": 12,
50+
"Accept": ["Accept: application/json", "Accept: text/plain"],
51+
},
4852
body="Hello world!",
4953
)
5054

5155
resp = httpq.Response(
5256
protocol="HTTP/1.1",
5357
status=200,
5458
reason="OK",
55-
headers={"Content-Length": 12},
59+
headers={"Content-Length": 12, "Content-Type": "text/plain"},
5660
body="Hello world!",
5761
)
5862
```
@@ -64,13 +68,16 @@ req = httpq.Request.parse(
6468
b"GET /get HTTP/1.1\r\n"
6569
b"Host: httpbin.org\r\n"
6670
b"Content-Length: 12\r\n"
71+
b"Accept: application/json\r\n"
72+
b"Accept: text/plain\r\n"
6773
b"\r\n"
6874
b"Hello world!"
6975
)
7076

7177
resp = httpq.Response.parse(
7278
b"HTTP/1.1 200 OK\r\n"
7379
b"Content-Length: 12\r\n"
80+
b"Content-Type: text/plain\r\n"
7481
b"\r\n"
7582
b"Hello world!"
7683
)
@@ -83,12 +90,15 @@ req = httpq.Request()
8390
req.feed(b"GET /get HTTP/1.1\r\n")
8491
req.feed(b"Host: httpbin.org\r\n")
8592
req.feed(b"Content-Length: 18\r\n")
93+
req.feed(b"Accept: application/json\r\n")
94+
req.feed(b"Accept: text/plain\r\n")
8695
req.feed(b"\r\n")
8796
req.feed(b"Hello world!")
8897

8998
resp = httpq.Response()
9099
resp.feed(b"HTTP/1.1 200 OK\r\n")
91100
resp.feed(b"Content-Length: 12\r\n")
101+
resp.feed(b"Content-Type: text/plain\r\n")
92102
resp.feed(b"\r\n")
93103
resp.feed(b"Hello world!")
94104
```

0 commit comments

Comments
 (0)