@@ -44,15 +44,19 @@ req = httpq.Request(
44
44
method = " GET" ,
45
45
target = " /get" ,
46
46
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
+ },
48
52
body = " Hello world!" ,
49
53
)
50
54
51
55
resp = httpq.Response(
52
56
protocol = " HTTP/1.1" ,
53
57
status = 200 ,
54
58
reason = " OK" ,
55
- headers = {" Content-Length" : 12 },
59
+ headers = {" Content-Length" : 12 , " Content-Type " : " text/plain " },
56
60
body = " Hello world!" ,
57
61
)
58
62
```
@@ -64,13 +68,16 @@ req = httpq.Request.parse(
64
68
b " GET /get HTTP/1.1\r\n "
65
69
b " Host: httpbin.org\r\n "
66
70
b " Content-Length: 12\r\n "
71
+ b " Accept: application/json\r\n "
72
+ b " Accept: text/plain\r\n "
67
73
b " \r\n "
68
74
b " Hello world!"
69
75
)
70
76
71
77
resp = httpq.Response.parse(
72
78
b " HTTP/1.1 200 OK\r\n "
73
79
b " Content-Length: 12\r\n "
80
+ b " Content-Type: text/plain\r\n "
74
81
b " \r\n "
75
82
b " Hello world!"
76
83
)
@@ -83,12 +90,15 @@ req = httpq.Request()
83
90
req.feed(b " GET /get HTTP/1.1\r\n " )
84
91
req.feed(b " Host: httpbin.org\r\n " )
85
92
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 " )
86
95
req.feed(b " \r\n " )
87
96
req.feed(b " Hello world!" )
88
97
89
98
resp = httpq.Response()
90
99
resp.feed(b " HTTP/1.1 200 OK\r\n " )
91
100
resp.feed(b " Content-Length: 12\r\n " )
101
+ resp.feed(b " Content-Type: text/plain\r\n " )
92
102
resp.feed(b " \r\n " )
93
103
resp.feed(b " Hello world!" )
94
104
```
0 commit comments