Skip to content

Commit a82be4a

Browse files
committed
fix request testing
1 parent 950c73a commit a82be4a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

morebuiltins/request.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class req:
147147
"""A basic mock for requests, performant albeit simplistic.
148148
149149
>>> import time
150-
>>> r = req.get("https://postman-echo.com/get?a=2", timeout=3, params={"b": "3"})
150+
>>> r = req.get("https://postman-echo.com/get?a=2", headers={"User-Agent": "Chrome"}, timeout=3, params={"b": "3"})
151151
>>> r.url
152152
'https://postman-echo.com/get?a=2&b=3'
153153
>>> r.ok
@@ -156,12 +156,12 @@ class req:
156156
200
157157
>>> r.text.startswith('{')
158158
True
159-
>>> r = req.post("https://postman-echo.com/post?a=2", timeout=3, params={"b": "3"}, data=b"mock data")
159+
>>> r = req.post("https://postman-echo.com/post?a=2", headers={"User-Agent": "Chrome"}, timeout=3, params={"b": "3"}, data=b"mock data")
160160
>>> r.json()["data"]
161161
'mock data'
162162
>>> r.json()["args"]
163163
{'a': '2', 'b': '3'}
164-
>>> r = req.post("https://postman-echo.com/post?a=2", timeout=3, json={"data": "yes json"})
164+
>>> r = req.post("https://postman-echo.com/post?a=2", headers={"User-Agent": "Chrome"}, timeout=3, json={"data": "yes json"})
165165
>>> r.json()["json"]
166166
{'data': 'yes json'}
167167
"""

0 commit comments

Comments
 (0)