http for network
Various commands for working with http methods.
Signature
> http {flags} (URL) (data)
Flags
--content-type, -t {any}: The MIME type of content to post.--user, -u {any}: The username when authenticating.--password, -p {any}: The password when authenticating.--max-time, -m {duration}: Max duration before timeout occurs.--headers, -H {any}: Custom headers you want to add.--raw, -r: Fetch contents as text rather than a table.--insecure, -k: Allow insecure server connections when using SSL.--full, -f: Returns the record, containing metainformation about the exchange in addition to the response. Returning record fields: - urls: list of url redirects this command had to make to get to the destination - headers.request: list of headers passed when doing the request - headers.response: list of received headers - body: the http body of the response - status: the http status of the response.--allow-errors, -e: Do not fail if the server returns an error code.--redirect-mode, -R {string}: What to do when encountering redirects. Default: 'follow'. Valid options: 'follow' ('f'), 'manual' ('m'), 'error' ('e').
Parameters
URL: The URL to fetch the contents from.data: The contents of the post body. Required unless part of a pipeline.
Input/output types:
| input | output |
|---|---|
| nothing | any |
Examples
Get content from example.com with default verb.
> http https://www.example.comPost content to example.com with default verb.
> http https://www.example.com 'body'Get content from example.com with explicit verb.
> http get https://www.example.comNotes
Without a subcommand but with a URL provided, it performs a GET request by default or a POST request if data is provided. You can use one of the following subcommands. Using this command as-is will only display this help message.
Subcommands:
| name | description | type |
|---|---|---|
http delete | Delete the specified resource. | built-in |
http get | Fetch the contents from a URL. | built-in |
http head | Get the headers from a URL. | built-in |
http options | Requests permitted communication options for a given URL. | built-in |
http patch | Send a PATCH request to a URL with a request body. | built-in |
http pool | Configure and reset builtin http connection pool. | built-in |
http post | Send a POST request to a URL with a request body. | built-in |
http put | Send a PUT request to a URL with a request body. | built-in |