httpdbg 0.22.0__tar.gz → 0.23.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {httpdbg-0.22.0 → httpdbg-0.23.0}/PKG-INFO +2 -1
- {httpdbg-0.22.0 → httpdbg-0.23.0}/README.md +1 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/__init__.py +1 -1
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/__main__.py +2 -2
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/args.py +6 -0
- httpdbg-0.23.0/httpdbg/exception.py +7 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/server.py +11 -5
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg.egg-info/PKG-INFO +2 -1
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg.egg-info/SOURCES.txt +3 -1
- {httpdbg-0.22.0 → httpdbg-0.23.0}/tests/test_api.py +31 -31
- {httpdbg-0.22.0 → httpdbg-0.23.0}/tests/test_mode_console.py +3 -3
- {httpdbg-0.22.0 → httpdbg-0.23.0}/tests/test_mode_module_pytest.py +10 -10
- {httpdbg-0.22.0 → httpdbg-0.23.0}/tests/test_mode_script.py +9 -9
- httpdbg-0.23.0/tests/test_server.py +40 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/LICENSE +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/hooks/__init__.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/hooks/aiohttp.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/hooks/all.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/hooks/external.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/hooks/generic.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/hooks/httpx.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/hooks/requests.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/hooks/socket.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/hooks/urllib3.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/hooks/utils.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/initiator.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/mode_console.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/mode_module.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/mode_script.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/preview.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/records.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/utils.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/__init__.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/api.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/app.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/api.js +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/column.css +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/configuration.js +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/detail.css +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/favicon.ico +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/filter.js +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/icons/chevron-direction-top-outline-icon.svg +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/icons/download-install-line-icon.svg +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/icons/engine-gears-icon.svg +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/icons/files-papers-outline-icon.svg +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/icons/filter-outline-icon.svg +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/icons/information-mark-circle-outline-icon.svg +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/icons/math-multiplication-icon.svg +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/icons/push-pin-green-icon.svg +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/icons/question-mark-round-line-icon.svg +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/icons/recycle-bin-line-icon.svg +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/icons/wait-sandclock-icon.svg +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/index.htm +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/main.js +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/mustache.min.js +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/render.js +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/style.css +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/table.css +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg.egg-info/dependency_links.txt +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg.egg-info/entry_points.txt +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg.egg-info/requires.txt +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg.egg-info/top_level.txt +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/pyproject.toml +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/setup.cfg +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/tests/test_cli.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/tests/test_context_manager.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/tests/test_hook_aiohttp.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/tests/test_hook_httpx.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/tests/test_hook_requests.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/tests/test_hook_urllib3.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/tests/test_initiator.py +0 -0
- {httpdbg-0.22.0 → httpdbg-0.23.0}/tests/test_preview.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: httpdbg
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.23.0
|
|
4
4
|
Summary: A very simple tool to debug HTTP(S) client requests
|
|
5
5
|
Author-email: cle-b <cle@tictac.pm>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -132,6 +132,7 @@ httdbg - a very simple tool to debug HTTP(S) client requests
|
|
|
132
132
|
|
|
133
133
|
options:
|
|
134
134
|
-h, --help show this help message and exit
|
|
135
|
+
--host HOST the web interface host IP address
|
|
135
136
|
--port PORT, -p PORT the web interface port
|
|
136
137
|
--version, -v print the httpdbg version
|
|
137
138
|
--initiator INITIATOR, -i INITIATOR
|
|
@@ -104,6 +104,7 @@ httdbg - a very simple tool to debug HTTP(S) client requests
|
|
|
104
104
|
|
|
105
105
|
options:
|
|
106
106
|
-h, --help show this help message and exit
|
|
107
|
+
--host HOST the web interface host IP address
|
|
107
108
|
--port PORT, -p PORT the web interface port
|
|
108
109
|
--version, -v print the httpdbg version
|
|
109
110
|
--initiator INITIATOR, -i INITIATOR
|
|
@@ -18,13 +18,13 @@ def print_msg(msg):
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def pyhttpdbg(params, subparams, test_mode=False):
|
|
21
|
-
url = f"http://
|
|
21
|
+
url = f"http://{params.host}:{params.port}/{'?hi=on' if params.console else ''}"
|
|
22
22
|
|
|
23
23
|
print_msg(f" httpdbg - HTTP(S) requests available at {url}")
|
|
24
24
|
|
|
25
25
|
sys.path.insert(0, "") # to mimic the default python command behavior
|
|
26
26
|
|
|
27
|
-
with httpdbg_srv(params.port) as records:
|
|
27
|
+
with httpdbg_srv(params.host, params.port) as records:
|
|
28
28
|
with httprecord(records, params.initiator):
|
|
29
29
|
if params.module:
|
|
30
30
|
run_module(subparams)
|
|
@@ -15,6 +15,12 @@ def read_args(args: List[str]) -> Tuple[argparse.Namespace, List[str]]:
|
|
|
15
15
|
parser = argparse.ArgumentParser(
|
|
16
16
|
description="httdbg - a very simple tool to debug HTTP(S) client requests"
|
|
17
17
|
)
|
|
18
|
+
parser.add_argument(
|
|
19
|
+
"--host",
|
|
20
|
+
type=str,
|
|
21
|
+
default="localhost",
|
|
22
|
+
help="the web interface host IP address",
|
|
23
|
+
)
|
|
18
24
|
parser.add_argument(
|
|
19
25
|
"--port", "-p", type=int, default=4909, help="the web interface port"
|
|
20
26
|
)
|
|
@@ -4,17 +4,23 @@ from http.server import HTTPServer
|
|
|
4
4
|
import threading
|
|
5
5
|
from typing import Generator
|
|
6
6
|
|
|
7
|
+
from httpdbg.exception import HttpdbgException
|
|
7
8
|
from httpdbg.records import HTTPRecords
|
|
8
9
|
from httpdbg.webapp import HttpbgHTTPRequestHandler
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@contextmanager
|
|
12
|
-
def httpdbg_srv(port: int) -> Generator[HTTPRecords, None, None]:
|
|
13
|
+
def httpdbg_srv(host: str, port: int) -> Generator[HTTPRecords, None, None]:
|
|
13
14
|
server = None
|
|
14
15
|
records = HTTPRecords()
|
|
15
16
|
try:
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
try:
|
|
18
|
+
server = ServerThread(host, port, records)
|
|
19
|
+
server.start()
|
|
20
|
+
except Exception as ex_server_start:
|
|
21
|
+
raise HttpdbgException(
|
|
22
|
+
f"An issue occurred while starting the httpdbg web interface: [{str(ex_server_start)}]"
|
|
23
|
+
)
|
|
18
24
|
|
|
19
25
|
yield records
|
|
20
26
|
|
|
@@ -26,14 +32,14 @@ def httpdbg_srv(port: int) -> Generator[HTTPRecords, None, None]:
|
|
|
26
32
|
|
|
27
33
|
|
|
28
34
|
class ServerThread(threading.Thread):
|
|
29
|
-
def __init__(self, port: int, records: HTTPRecords) -> None:
|
|
35
|
+
def __init__(self, host: str, port: int, records: HTTPRecords) -> None:
|
|
30
36
|
threading.Thread.__init__(self)
|
|
31
37
|
self.port = port
|
|
32
38
|
|
|
33
39
|
def http_request_handler(*args, **kwargs):
|
|
34
40
|
HttpbgHTTPRequestHandler(records, *args, **kwargs)
|
|
35
41
|
|
|
36
|
-
self.srv = HTTPServer((
|
|
42
|
+
self.srv = HTTPServer((host, port), http_request_handler)
|
|
37
43
|
|
|
38
44
|
def run(self):
|
|
39
45
|
self.srv.serve_forever()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: httpdbg
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.23.0
|
|
4
4
|
Summary: A very simple tool to debug HTTP(S) client requests
|
|
5
5
|
Author-email: cle-b <cle@tictac.pm>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -132,6 +132,7 @@ httdbg - a very simple tool to debug HTTP(S) client requests
|
|
|
132
132
|
|
|
133
133
|
options:
|
|
134
134
|
-h, --help show this help message and exit
|
|
135
|
+
--host HOST the web interface host IP address
|
|
135
136
|
--port PORT, -p PORT the web interface port
|
|
136
137
|
--version, -v print the httpdbg version
|
|
137
138
|
--initiator INITIATOR, -i INITIATOR
|
|
@@ -5,6 +5,7 @@ setup.cfg
|
|
|
5
5
|
httpdbg/__init__.py
|
|
6
6
|
httpdbg/__main__.py
|
|
7
7
|
httpdbg/args.py
|
|
8
|
+
httpdbg/exception.py
|
|
8
9
|
httpdbg/initiator.py
|
|
9
10
|
httpdbg/mode_console.py
|
|
10
11
|
httpdbg/mode_module.py
|
|
@@ -66,4 +67,5 @@ tests/test_initiator.py
|
|
|
66
67
|
tests/test_mode_console.py
|
|
67
68
|
tests/test_mode_module_pytest.py
|
|
68
69
|
tests/test_mode_script.py
|
|
69
|
-
tests/test_preview.py
|
|
70
|
+
tests/test_preview.py
|
|
71
|
+
tests/test_server.py
|
|
@@ -11,12 +11,12 @@ from utils import get_request_details
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
@pytest.mark.api
|
|
14
|
-
def test_api_requests_one_request(httpbin, httpdbg_port):
|
|
15
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
14
|
+
def test_api_requests_one_request(httpbin, httpdbg_host, httpdbg_port):
|
|
15
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
16
16
|
with httprecord(records):
|
|
17
17
|
requests.get(httpbin.url + "/get")
|
|
18
18
|
|
|
19
|
-
ret = requests.get(f"http://
|
|
19
|
+
ret = requests.get(f"http://{httpdbg_host}:{httpdbg_port}/requests")
|
|
20
20
|
|
|
21
21
|
reqs = ret.json()["requests"]
|
|
22
22
|
|
|
@@ -25,13 +25,13 @@ def test_api_requests_one_request(httpbin, httpdbg_port):
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
@pytest.mark.api
|
|
28
|
-
def test_api_requests_two_requests(httpbin, httpdbg_port):
|
|
29
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
28
|
+
def test_api_requests_two_requests(httpbin, httpdbg_host, httpdbg_port):
|
|
29
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
30
30
|
with httprecord(records):
|
|
31
31
|
requests.get(httpbin.url + "/get?abc")
|
|
32
32
|
requests.get(httpbin.url + "/get?def")
|
|
33
33
|
|
|
34
|
-
ret = requests.get(f"http://
|
|
34
|
+
ret = requests.get(f"http://{httpdbg_host}:{httpdbg_port}/requests")
|
|
35
35
|
|
|
36
36
|
reqs = ret.json()["requests"]
|
|
37
37
|
|
|
@@ -41,11 +41,11 @@ def test_api_requests_two_requests(httpbin, httpdbg_port):
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
@pytest.mark.api
|
|
44
|
-
def test_api_requests_netloc(httpbin, httpdbg_port):
|
|
45
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
44
|
+
def test_api_requests_netloc(httpbin, httpdbg_host, httpdbg_port):
|
|
45
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
46
46
|
with httprecord(records):
|
|
47
47
|
requests.get(httpbin.url + "/get?abc")
|
|
48
|
-
ret = requests.get(f"http://
|
|
48
|
+
ret = requests.get(f"http://{httpdbg_host}:{httpdbg_port}/requests")
|
|
49
49
|
|
|
50
50
|
reqs = ret.json()["requests"]
|
|
51
51
|
|
|
@@ -56,8 +56,8 @@ def test_api_requests_netloc(httpbin, httpdbg_port):
|
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
@pytest.mark.api
|
|
59
|
-
def test_api_request_by_id(httpbin, httpdbg_port):
|
|
60
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
59
|
+
def test_api_request_by_id(httpbin, httpdbg_host, httpdbg_port):
|
|
60
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
61
61
|
with httprecord(records):
|
|
62
62
|
requests.get(httpbin.url + "/get?abc")
|
|
63
63
|
requests.get(httpbin.url + "/get?def")
|
|
@@ -73,20 +73,20 @@ def test_api_request_by_id(httpbin, httpdbg_port):
|
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
@pytest.mark.api
|
|
76
|
-
def test_api_request_by_id_not_exists(httpbin, httpdbg_port):
|
|
77
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
76
|
+
def test_api_request_by_id_not_exists(httpbin, httpdbg_host, httpdbg_port):
|
|
77
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
78
78
|
with httprecord(records):
|
|
79
79
|
requests.get(httpbin.url + "/get?abc")
|
|
80
80
|
requests.get(httpbin.url + "/get?def")
|
|
81
81
|
|
|
82
|
-
ret = requests.get(f"http://
|
|
82
|
+
ret = requests.get(f"http://{httpdbg_host}:{httpdbg_port}/request/999")
|
|
83
83
|
|
|
84
84
|
assert ret.status_code == 404
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
@pytest.mark.api
|
|
88
|
-
def test_api_get_request_get(httpbin, httpdbg_port):
|
|
89
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
88
|
+
def test_api_get_request_get(httpbin, httpdbg_host, httpdbg_port):
|
|
89
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
90
90
|
with httprecord(records):
|
|
91
91
|
requests.get(httpbin.url + "/")
|
|
92
92
|
requests.get(httpbin.url + "/get")
|
|
@@ -95,7 +95,7 @@ def test_api_get_request_get(httpbin, httpdbg_port):
|
|
|
95
95
|
|
|
96
96
|
path_to_content = ret.json()["response"]["body"]["path"]
|
|
97
97
|
req_response_content = requests.get(
|
|
98
|
-
f"http://
|
|
98
|
+
f"http://{httpdbg_host}:{httpdbg_port}{path_to_content}"
|
|
99
99
|
)
|
|
100
100
|
|
|
101
101
|
# headers
|
|
@@ -122,8 +122,8 @@ def test_api_get_request_get(httpbin, httpdbg_port):
|
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
@pytest.mark.api
|
|
125
|
-
def test_api_get_request_post(httpbin, httpdbg_port):
|
|
126
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
125
|
+
def test_api_get_request_post(httpbin, httpdbg_host, httpdbg_port):
|
|
126
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
127
127
|
with httprecord(records):
|
|
128
128
|
requests.get(httpbin.url + "/")
|
|
129
129
|
requests.post(httpbin.url + "/post", data=b"data to post")
|
|
@@ -132,12 +132,12 @@ def test_api_get_request_post(httpbin, httpdbg_port):
|
|
|
132
132
|
|
|
133
133
|
path_to_content = ret.json()["request"]["body"]["path"]
|
|
134
134
|
req_request_content = requests.get(
|
|
135
|
-
f"http://
|
|
135
|
+
f"http://{httpdbg_host}:{httpdbg_port}{path_to_content}"
|
|
136
136
|
)
|
|
137
137
|
|
|
138
138
|
path_to_content = ret.json()["response"]["body"]["path"]
|
|
139
139
|
req_response_content = requests.get(
|
|
140
|
-
f"http://
|
|
140
|
+
f"http://{httpdbg_host}:{httpdbg_port}{path_to_content}"
|
|
141
141
|
)
|
|
142
142
|
|
|
143
143
|
# headers
|
|
@@ -167,8 +167,8 @@ def test_api_get_request_post(httpbin, httpdbg_port):
|
|
|
167
167
|
|
|
168
168
|
|
|
169
169
|
@pytest.mark.api
|
|
170
|
-
def test_api_get_request_get_status_404(httpbin, httpdbg_port):
|
|
171
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
170
|
+
def test_api_get_request_get_status_404(httpbin, httpdbg_host, httpdbg_port):
|
|
171
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
172
172
|
with httprecord(records):
|
|
173
173
|
ret = requests.get(httpbin.url + "/abc")
|
|
174
174
|
assert ret.status_code == 404
|
|
@@ -181,10 +181,10 @@ def test_api_get_request_get_status_404(httpbin, httpdbg_port):
|
|
|
181
181
|
|
|
182
182
|
|
|
183
183
|
@pytest.mark.api
|
|
184
|
-
def test_api_get_request_connection_error(httpbin, httpdbg_port):
|
|
184
|
+
def test_api_get_request_connection_error(httpbin, httpdbg_host, httpdbg_port):
|
|
185
185
|
url_with_unknown_host = "http://f.q.d.1234.n.t.n.e/hello?a=b"
|
|
186
186
|
|
|
187
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
187
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
188
188
|
with httprecord(records):
|
|
189
189
|
with pytest.raises(requests.exceptions.ConnectionError):
|
|
190
190
|
requests.get(url_with_unknown_host)
|
|
@@ -197,8 +197,8 @@ def test_api_get_request_connection_error(httpbin, httpdbg_port):
|
|
|
197
197
|
|
|
198
198
|
|
|
199
199
|
@pytest.mark.api
|
|
200
|
-
def test_api_get_request_content_up_text(httpbin, httpdbg_port):
|
|
201
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
200
|
+
def test_api_get_request_content_up_text(httpbin, httpdbg_host, httpdbg_port):
|
|
201
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
202
202
|
with httprecord(records):
|
|
203
203
|
requests.post(httpbin.url + "/post", data={"a": 1, "b": 2})
|
|
204
204
|
requests.post(httpbin.url + "/post", data="hello")
|
|
@@ -215,8 +215,8 @@ def test_api_get_request_content_up_text(httpbin, httpdbg_port):
|
|
|
215
215
|
|
|
216
216
|
@pytest.mark.api
|
|
217
217
|
@pytest.mark.cookies
|
|
218
|
-
def test_cookies_request(httpbin, httpdbg_port):
|
|
219
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
218
|
+
def test_cookies_request(httpbin, httpdbg_host, httpdbg_port):
|
|
219
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
220
220
|
with httprecord(records):
|
|
221
221
|
session = requests.session()
|
|
222
222
|
session.cookies.set("COOKIE_NAME", "the-cookie-works")
|
|
@@ -232,8 +232,8 @@ def test_cookies_request(httpbin, httpdbg_port):
|
|
|
232
232
|
|
|
233
233
|
@pytest.mark.api
|
|
234
234
|
@pytest.mark.cookies
|
|
235
|
-
def test_cookies_response(httpbin, httpdbg_port):
|
|
236
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
235
|
+
def test_cookies_response(httpbin, httpdbg_host, httpdbg_port):
|
|
236
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
237
237
|
with httprecord(records):
|
|
238
238
|
session = requests.session()
|
|
239
239
|
session.get(
|
|
@@ -33,8 +33,8 @@ def test_run_console_from_pyhttpdbg_entry_point_default(
|
|
|
33
33
|
assert "test_mode is on" in capsys.readouterr().out
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
def test_run_console(httpbin, httpdbg_port):
|
|
37
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
36
|
+
def test_run_console(httpbin, httpdbg_host, httpdbg_port):
|
|
37
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
38
38
|
with httprecord(records):
|
|
39
39
|
new_console = run_console(test_mode=True)
|
|
40
40
|
new_console.push("import requests")
|
|
@@ -42,7 +42,7 @@ def test_run_console(httpbin, httpdbg_port):
|
|
|
42
42
|
with pytest.raises(SystemExit):
|
|
43
43
|
new_console.push("exit()")
|
|
44
44
|
|
|
45
|
-
ret = requests.get(f"http://
|
|
45
|
+
ret = requests.get(f"http://{httpdbg_host}:{httpdbg_port}/requests")
|
|
46
46
|
|
|
47
47
|
reqs = ret.json()["requests"]
|
|
48
48
|
|
|
@@ -11,7 +11,7 @@ from httpdbg.server import httpdbg_srv
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
@pytest.mark.pytest
|
|
14
|
-
def test_run_pytest_from_pyhttpdbg_entry_point(httpbin,
|
|
14
|
+
def test_run_pytest_from_pyhttpdbg_entry_point(httpbin, monkeypatch):
|
|
15
15
|
os.environ["HTTPDBG_TEST_PYTEST_BASE_URL"] = httpbin.url
|
|
16
16
|
script_to_run = os.path.join(
|
|
17
17
|
os.path.dirname(os.path.realpath(__file__)), "demo_run_pytest.py"
|
|
@@ -29,8 +29,8 @@ def test_run_pytest_from_pyhttpdbg_entry_point(httpbin, httpdbg_port, monkeypatc
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
@pytest.mark.pytest
|
|
32
|
-
def test_run_pytest(httpbin, httpdbg_port):
|
|
33
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
32
|
+
def test_run_pytest(httpbin, httpdbg_host, httpdbg_port):
|
|
33
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
34
34
|
with httprecord(records):
|
|
35
35
|
os.environ["HTTPDBG_TEST_PYTEST_BASE_URL"] = httpbin.url
|
|
36
36
|
script_to_run = os.path.join(
|
|
@@ -38,7 +38,7 @@ def test_run_pytest(httpbin, httpdbg_port):
|
|
|
38
38
|
)
|
|
39
39
|
run_module(["pytest", f"{script_to_run}::test_demo_pytest"])
|
|
40
40
|
|
|
41
|
-
ret = requests.get(f"http://
|
|
41
|
+
ret = requests.get(f"http://{httpdbg_host}:{httpdbg_port}/requests")
|
|
42
42
|
|
|
43
43
|
reqs = ret.json()["requests"]
|
|
44
44
|
|
|
@@ -49,15 +49,15 @@ def test_run_pytest(httpbin, httpdbg_port):
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
@pytest.mark.pytest
|
|
52
|
-
def test_run_pytest_with_exception(httpdbg_port, capsys):
|
|
53
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
52
|
+
def test_run_pytest_with_exception(httpdbg_host, httpdbg_port, capsys):
|
|
53
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
54
54
|
with httprecord(records):
|
|
55
55
|
script_to_run = os.path.join(
|
|
56
56
|
os.path.dirname(os.path.realpath(__file__)), "demo_run_pytest.py"
|
|
57
57
|
)
|
|
58
58
|
run_module(["pytest", f"{script_to_run}::test_demo_raise_exception"])
|
|
59
59
|
|
|
60
|
-
ret = requests.get(f"http://
|
|
60
|
+
ret = requests.get(f"http://{httpdbg_host}:{httpdbg_port}/requests")
|
|
61
61
|
|
|
62
62
|
reqs = ret.json()["requests"]
|
|
63
63
|
|
|
@@ -68,8 +68,8 @@ def test_run_pytest_with_exception(httpdbg_port, capsys):
|
|
|
68
68
|
|
|
69
69
|
@pytest.mark.api
|
|
70
70
|
@pytest.mark.pytest
|
|
71
|
-
def test_run_pytest_initiator(httpbin, httpdbg_port):
|
|
72
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
71
|
+
def test_run_pytest_initiator(httpbin, httpdbg_host, httpdbg_port):
|
|
72
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
73
73
|
with httprecord(records):
|
|
74
74
|
os.environ["HTTPDBG_TEST_PYTEST_BASE_URL"] = httpbin.url
|
|
75
75
|
script_to_run = os.path.join(
|
|
@@ -77,7 +77,7 @@ def test_run_pytest_initiator(httpbin, httpdbg_port):
|
|
|
77
77
|
)
|
|
78
78
|
run_module(["pytest", f"{script_to_run}::test_demo_pytest"])
|
|
79
79
|
|
|
80
|
-
ret = requests.get(f"http://
|
|
80
|
+
ret = requests.get(f"http://{httpdbg_host}:{httpdbg_port}/requests")
|
|
81
81
|
|
|
82
82
|
reqs = ret.json()["requests"]
|
|
83
83
|
|
|
@@ -23,15 +23,15 @@ def test_run_script_from_pyhttpdbg_entry_point(httpbin, monkeypatch):
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
@pytest.mark.script
|
|
26
|
-
def test_run_script(httpbin, httpdbg_port):
|
|
27
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
26
|
+
def test_run_script(httpbin, httpdbg_host, httpdbg_port):
|
|
27
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
28
28
|
with httprecord(records):
|
|
29
29
|
script_to_run = os.path.join(
|
|
30
30
|
os.path.dirname(os.path.realpath(__file__)), "demo_run_script.py"
|
|
31
31
|
)
|
|
32
32
|
run_script([script_to_run, httpbin.url])
|
|
33
33
|
|
|
34
|
-
ret = requests.get(f"http://
|
|
34
|
+
ret = requests.get(f"http://{httpdbg_host}:{httpdbg_port}/requests")
|
|
35
35
|
|
|
36
36
|
reqs = ret.json()["requests"]
|
|
37
37
|
|
|
@@ -41,15 +41,15 @@ def test_run_script(httpbin, httpdbg_port):
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
@pytest.mark.script
|
|
44
|
-
def test_run_script_with_exception(httpbin, httpdbg_port, capsys):
|
|
45
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
44
|
+
def test_run_script_with_exception(httpbin, httpdbg_host, httpdbg_port, capsys):
|
|
45
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
46
46
|
with httprecord(records):
|
|
47
47
|
script_to_run = os.path.join(
|
|
48
48
|
os.path.dirname(os.path.realpath(__file__)), "demo_run_script.py"
|
|
49
49
|
)
|
|
50
50
|
run_script([script_to_run, httpbin.url, "raise_exception"])
|
|
51
51
|
|
|
52
|
-
ret = requests.get(f"http://
|
|
52
|
+
ret = requests.get(f"http://{httpdbg_host}:{httpdbg_port}/requests")
|
|
53
53
|
|
|
54
54
|
reqs = ret.json()["requests"]
|
|
55
55
|
|
|
@@ -73,15 +73,15 @@ def test_run_script_not_a_python_script(httpbin, capsys):
|
|
|
73
73
|
|
|
74
74
|
@pytest.mark.api
|
|
75
75
|
@pytest.mark.script
|
|
76
|
-
def test_run_script_initiator(httpbin, httpdbg_port):
|
|
77
|
-
with httpdbg_srv(httpdbg_port) as records:
|
|
76
|
+
def test_run_script_initiator(httpbin, httpdbg_host, httpdbg_port):
|
|
77
|
+
with httpdbg_srv(httpdbg_host, httpdbg_port) as records:
|
|
78
78
|
with httprecord(records):
|
|
79
79
|
script_to_run = os.path.join(
|
|
80
80
|
os.path.dirname(os.path.realpath(__file__)), "demo_run_script.py"
|
|
81
81
|
)
|
|
82
82
|
run_script([script_to_run, httpbin.url])
|
|
83
83
|
|
|
84
|
-
ret = requests.get(f"http://
|
|
84
|
+
ret = requests.get(f"http://{httpdbg_host}:{httpdbg_port}/requests")
|
|
85
85
|
|
|
86
86
|
reqs = ret.json()["requests"]
|
|
87
87
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import requests
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
from httpdbg.exception import HttpdbgException
|
|
7
|
+
from httpdbg.hooks.all import httprecord
|
|
8
|
+
from httpdbg.server import httpdbg_srv
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@pytest.mark.server
|
|
12
|
+
@pytest.mark.parametrize("host", ["localhost", "0.0.0.0"])
|
|
13
|
+
def test_server_host(httpbin, host, httpdbg_port):
|
|
14
|
+
with httpdbg_srv(host, httpdbg_port) as records:
|
|
15
|
+
with httprecord(records):
|
|
16
|
+
requests.get(httpbin.url + "/get")
|
|
17
|
+
|
|
18
|
+
ret = requests.get(f"http://localhost:{httpdbg_port}/requests")
|
|
19
|
+
|
|
20
|
+
reqs = ret.json()["requests"]
|
|
21
|
+
|
|
22
|
+
assert len(reqs) == 1
|
|
23
|
+
assert reqs[list(reqs.keys())[0]]["url"] == httpbin.url + "/get"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@pytest.mark.server
|
|
27
|
+
def test_server_host_exception_host(httpdbg_port):
|
|
28
|
+
host = "1.2.3.4"
|
|
29
|
+
with pytest.raises(HttpdbgException):
|
|
30
|
+
with httpdbg_srv(host, httpdbg_port):
|
|
31
|
+
pass
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@pytest.mark.server
|
|
35
|
+
def test_server_host_exception_port():
|
|
36
|
+
host = "127.0.0.1"
|
|
37
|
+
port = 123456789
|
|
38
|
+
with pytest.raises(HttpdbgException):
|
|
39
|
+
with httpdbg_srv(host, port):
|
|
40
|
+
pass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/icons/chevron-direction-top-outline-icon.svg
RENAMED
|
File without changes
|
{httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/icons/download-install-line-icon.svg
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{httpdbg-0.22.0 → httpdbg-0.23.0}/httpdbg/webapp/static/icons/question-mark-round-line-icon.svg
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|