Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions httpie/cli/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ def _process_request_type(self):
}

def _process_url(self):
if self.args.http_file:
# do not add default scheme
# treat URL as a filename if --http-file is specified
return
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if --file wouldn't be nicer to read.

http --http-file example.http

vs.

http --file example.http

Read from stdin

An elegant alternative – the nicest way, in my opinion – would be to read from standard input, e.g.

Redirect a file:

$ http < example.http

Parse some text verbatim:

$ echo "
    GET http://localhost:8080/list
    Accept: application/json
" | http

Interpret input typed or pasted in the console:

$ http
GET http://localhost:8080/list
Accept: application/json
^D

if self.args.url.startswith('://'):
# Paste URL & add space shortcut: `http ://pie.dev` → `http://pie.dev`
self.args.url = self.args.url[3:]
Expand Down
Loading
Loading