sibylline-scurl 0.1.0__tar.gz → 0.1.1__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.
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/PKG-INFO +1 -1
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/pyproject.toml +1 -1
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/src/scurl/__init__.py +1 -1
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/src/scurl/curl.py +6 -0
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/tests/test_curl.py +16 -0
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/.github/workflows/ci.yml +0 -0
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/.github/workflows/publish.yml +0 -0
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/.gitignore +0 -0
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/README.md +0 -0
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/src/scurl/cli.py +0 -0
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/src/scurl/middleware.py +0 -0
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/src/scurl/request_middleware.py +0 -0
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/src/scurl/response_middleware.py +0 -0
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/tests/__init__.py +0 -0
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/tests/test_cli.py +0 -0
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/tests/test_middleware.py +0 -0
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/tests/test_response_middleware.py +0 -0
- {sibylline_scurl-0.1.0 → sibylline_scurl-0.1.1}/tests/test_secret_defender.py +0 -0
|
@@ -32,10 +32,16 @@ def parse_curl_args(args: list[str]) -> RequestContext:
|
|
|
32
32
|
arg = args[i]
|
|
33
33
|
|
|
34
34
|
# URL (positional or after flags)
|
|
35
|
+
# Accept URLs with scheme or bare hostnames (like curl does)
|
|
35
36
|
if arg.startswith("http://") or arg.startswith("https://"):
|
|
36
37
|
url = arg
|
|
37
38
|
i += 1
|
|
38
39
|
continue
|
|
40
|
+
elif not arg.startswith("-") and ("." in arg or arg.startswith("localhost")) and not url:
|
|
41
|
+
# Bare hostname without scheme - curl defaults to http
|
|
42
|
+
url = arg
|
|
43
|
+
i += 1
|
|
44
|
+
continue
|
|
39
45
|
|
|
40
46
|
# Method
|
|
41
47
|
if arg in ("-X", "--request"):
|
|
@@ -139,6 +139,22 @@ class TestParseCurlArgs:
|
|
|
139
139
|
assert ctx.headers == {}
|
|
140
140
|
assert ctx.body is None
|
|
141
141
|
|
|
142
|
+
def test_bare_hostname(self):
|
|
143
|
+
"""Bare hostname without scheme should be accepted like curl."""
|
|
144
|
+
ctx = parse_curl_args(["www.google.com"])
|
|
145
|
+
|
|
146
|
+
assert ctx.url == "www.google.com"
|
|
147
|
+
|
|
148
|
+
def test_bare_hostname_with_path(self):
|
|
149
|
+
ctx = parse_curl_args(["example.com/path/to/page"])
|
|
150
|
+
|
|
151
|
+
assert ctx.url == "example.com/path/to/page"
|
|
152
|
+
|
|
153
|
+
def test_localhost(self):
|
|
154
|
+
ctx = parse_curl_args(["localhost:8080"])
|
|
155
|
+
|
|
156
|
+
assert ctx.url == "localhost:8080"
|
|
157
|
+
|
|
142
158
|
def test_unknown_flags_preserved(self):
|
|
143
159
|
"""Unknown flags should be preserved in curl_args for pass-through."""
|
|
144
160
|
args = ["-v", "--compressed", "-L", "https://example.com"]
|
|
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
|