1
0
mirror of https://github.com/httpie/cli.git synced 2025-08-10 22:42:05 +02:00

Strip leading :// from URLs to allow quick conversion of a pasted URL to calls (#1197)

* Strip leading `://` from URLs to allow quick conversion of a pasted URL to calls

Closes #1195

* Markdown lint

* Cleanup

* Cleanup

* Drop extraneous space

* Fix example
This commit is contained in:
Jakub Roztocil
2021-11-05 13:59:23 +01:00
committed by GitHub
parent 434512e92f
commit 861b8b36a8
4 changed files with 28 additions and 4 deletions

View File

@@ -120,6 +120,9 @@ class HTTPieArgumentParser(argparse.ArgumentParser):
}
def _process_url(self):
if self.args.url.startswith('://'):
# Paste URL & add space shortcut: `http ://pie.dev` → `http://pie.dev`
self.args.url = self.args.url[3:]
if not URL_SCHEME_RE.match(self.args.url):
if os.path.basename(self.env.program_name) == 'https':
scheme = 'https://'