MCPcopy Create free account
hub / github.com/boy-hack/hack-requests / test_json

Method test_json

tests/test_http_raw.py:47–62  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

45 self.assertTrue("a=1&b=2&c=heloo" in r.text())
46
47 def test_json(self):
48 raw = '''
49POST /post HTTP/1.1
50Host: httpbin.org
51Connection: keep-alive
52Upgrade-Insecure-Requests: 1
53User-Agent: celebrate hack-requests 1.0 !
54Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
55Accept-Encoding: gzip, deflate
56Accept-Language: zh-CN,zh;q=0.9,en;q=0.8
57Cookie: _gauges_unique_hour=1; _gauges_unique_day=1; _gauges_unique_month=1; _gauges_unique_year=1; _gauges_unique=1
58
59{"hack-requests":"v1.0","author":"w8ay"}
60 '''
61 r = self.hack.httpraw(raw)
62 self.assertTrue(json.loads(r.text())["json"] == {"author": "w8ay", "hack-requests": "v1.0"})
63
64 def test_chunked(self):
65 raw = '''

Callers

nothing calls this directly

Calls 2

textMethod · 0.80
httprawMethod · 0.45

Tested by

no test coverage detected