mirror of
https://github.com/httpie/cli.git
synced 2025-02-16 17:40:51 +01:00
parent
621042a048
commit
e49b5132fa
@ -203,6 +203,8 @@ class HTTPieArgumentParser(BaseHTTPieArgumentParser):
|
||||
}
|
||||
|
||||
def _process_url(self):
|
||||
self.args.url = self.args.base_url + self.args.url
|
||||
|
||||
if self.args.url.startswith('://'):
|
||||
# Paste URL & add space shortcut: `http ://pie.dev` → `http://pie.dev`
|
||||
self.args.url = self.args.url[3:]
|
||||
|
@ -78,6 +78,8 @@ positional_arguments.add_argument(
|
||||
$ http :3000 # => http://localhost:3000
|
||||
$ http :/foo # => http://localhost/foo
|
||||
|
||||
Prefixed with --base-url before default scheme or shorthand processing take place.
|
||||
|
||||
""",
|
||||
)
|
||||
positional_arguments.add_argument(
|
||||
@ -703,6 +705,16 @@ network.add_argument(
|
||||
action='store_true',
|
||||
short_help='Build the request and print it but don’t actually send it.'
|
||||
)
|
||||
network.add_argument(
|
||||
'--base-url',
|
||||
default='',
|
||||
short_help='String to prepend to the request URL.',
|
||||
help="""
|
||||
String to prepend to the request URL before --default-scheme and/or localhost
|
||||
shorthand are processed. If specified multiple times, last value is used.
|
||||
|
||||
"""
|
||||
)
|
||||
network.add_argument(
|
||||
'--proxy',
|
||||
default=[],
|
||||
|
@ -375,3 +375,8 @@ class TestSchemes:
|
||||
def test_scheme_when_invoked_as_https(self, httpbin_secure):
|
||||
url = f'{httpbin_secure.host}:{httpbin_secure.port}'
|
||||
assert HTTP_OK in http(url, program_name='https')
|
||||
|
||||
|
||||
class TestBaseUrl:
|
||||
def test_base_url(self):
|
||||
assert False, 'Needs tests'
|
||||
|
Loading…
Reference in New Issue
Block a user