MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / test_decode

Function test_decode

test/mitmproxy/net/http/test_multipart.py:6–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4
5
6def test_decode():
7 boundary = "somefancyboundary"
8 content = (
9 "--{0}\n"
10 'Content-Disposition: form-data; name="field1"\n\n'
11 "value1\n"
12 "--{0}\n"
13 'Content-Disposition: form-data; name="field2"\n\n'
14 "value2\n"
15 "--{0}--".format(boundary).encode()
16 )
17 form = multipart.decode_multipart(f"multipart/form-data; {boundary=!s}", content)
18
19 assert len(form) == 2
20 assert form[0] == (b"field1", b"value1")
21 assert form[1] == (b"field2", b"value2")
22
23 boundary = "boundary茅莽"
24 result = multipart.decode_multipart(f"multipart/form-data; {boundary=!s}", content)
25 assert result == []
26
27 assert multipart.decode_multipart("", content) == []
28
29
30def test_encode():

Callers

nothing calls this directly

Calls 2

formatMethod · 0.80
encodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…