### Installing HTTPie Plugins from PyPI (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command installs an HTTPie plugin from PyPI or a local path. The example demonstrates installing httpie-plugin, showing the installation progress and success message. ```bash $ httpie cli plugins install httpie-plugin Installing httpie-plugin... Successfully installed httpie-plugin-1.0.2 ``` -------------------------------- ### Initializing Development Environment - Make Bash Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md The `make all` command automates the initial setup of the development environment. It creates an isolated Python virtual environment, installs all project dependencies, installs HTTPie in editable mode, and runs initial tests. ```bash $ make all ``` -------------------------------- ### Installing HTTPie via Snapcraft (Linux) Source: https://github.com/httpie/cli/blob/master/docs/README.md Installs HTTPie on Linux using the Snapcraft package manager. Requires Snapcraft to be installed. The command installs the httpie snap. ```bash $ snap install httpie ``` -------------------------------- ### Installing HTTPie via Chocolatey (Windows) Source: https://github.com/httpie/cli/blob/master/docs/README.md Installs HTTPie on Windows using the Chocolatey package manager. Requires Chocolatey to be installed. The command installs the httpie package. ```bash $ choco install httpie ``` -------------------------------- ### Building, Installing, Testing, and Removing HTTPie Snap Package Source: https://github.com/httpie/cli/blob/master/docs/packaging/snapcraft/README.md This comprehensive snippet outlines the steps to clone the HTTPie repository, build its Snap package with specified CPU and memory limits, install the generated snap using the dangerous flag for local testing, and finally test and remove the installed snap. It covers the full development lifecycle within the Snapcraft environment. ```bash # Clone git clone --depth=1 https://github.com/httpie/cli.git cd httpie # Build export SNAPCRAFT_BUILD_ENVIRONMENT_CPU=8 export SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=16G snapcraft --debug # Install sudo snap install --dangerous httpie_XXX_amd64.snap # Test httpie.http --version httpie.https --version # Auto-aliases cannot be tested when installing a snap outside the store. # http --version # https --version # Remove sudo snap remove httpie ``` -------------------------------- ### Installing Unstable HTTPie via Snapcraft Source: https://github.com/httpie/cli/blob/master/docs/README.md These commands install the development (unstable) version of HTTPie on Linux using Snapcraft. The first command removes any existing Snap installation, and the second installs the latest 'edge' channel version. ```bash $ snap remove httpie $ snap install httpie --edge ``` -------------------------------- ### Installing HTTPie via pacman (Arch Linux) Source: https://github.com/httpie/cli/blob/master/docs/README.md Installs HTTPie on Arch Linux and its derivatives using the `pacman` package manager. The command synchronizes package databases and then installs the httpie package. ```bash $ pacman -Syu httpie ``` -------------------------------- ### Installing HTTPie via apt (Debian/Ubuntu Linux) Source: https://github.com/httpie/cli/blob/master/docs/README.md Installs HTTPie on Debian-derived Linux distributions using `apt`. This involves adding the HTTPie GPG key, configuring the APT repository, updating the package list, and then installing the httpie package. ```bash $ curl -SsL https://packages.httpie.io/deb/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/httpie.gpg $ echo "deb [arch=amd64 signed-by=/usr/share/keyrings/httpie.gpg] https://packages.httpie.io/deb ./" | sudo tee /etc/apt/sources.list.d/httpie.list > /dev/null $ sudo apt update $ sudo apt install httpie ``` -------------------------------- ### Installing HTTPie via FreshPorts (FreeBSD) Source: https://github.com/httpie/cli/blob/master/docs/README.md Installs HTTPie on FreeBSD using the `pkg` package manager, specifically from the FreshPorts collection. The command installs the `www/py-httpie` package. ```bash $ pkg install www/py-httpie ``` -------------------------------- ### Installing HTTPie via yum (CentOS/RHEL Linux) Source: https://github.com/httpie/cli/blob/master/docs/README.md Installs HTTPie on CentOS and RHEL-derived Linux distributions using `yum`. It first installs the EPEL repository, then installs the httpie package. ```bash $ yum install epel-release $ yum install httpie ``` -------------------------------- ### Installing HTTPie Single Binary (Linux) Source: https://github.com/httpie/cli/blob/master/docs/README.md Installs HTTPie as standalone single binary executables on Linux. This method downloads the latest binary, creates a symlink for `https`, and makes both executables runnable. ```bash $ https --download packages.httpie.io/binaries/linux/http-latest -o http $ ln -ls ./http ./https $ chmod +x ./http ./https ``` -------------------------------- ### Listing Installed HTTPie Plugins (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command lists all plugins currently installed in the HTTPie configuration directory. It displays the plugin name, version, and the specific plugin modules it provides. ```bash $ httpie cli plugins list httpie_plugin (1.0.2) httpie_plugin (httpie.plugins.auth.v1) httpie_plugin_2 (1.0.6) httpie_plugin_2 (httpie.plugins.auth.v1) httpie_converter (1.0.0) httpie_iterm_converter (httpie.plugins.converter.v1) httpie_konsole_konverter (httpie.plugins.converter.v1) ``` -------------------------------- ### Example HTTP Request with Dash-Prefixed Fields (HTTP) Source: https://github.com/httpie/cli/blob/master/docs/README.md Presents the raw HTTP request generated by the previous HTTPie command, demonstrating how a data field starting with a dash (-name-starting-with-dash) and a header (-Unusual-Header) are formatted in the actual HTTP payload. ```http POST /post HTTP/1.1 -Unusual-Header: bar Content-Type: application/json { "-name-starting-with-dash": "foo" } ``` -------------------------------- ### Sending a Basic GET Request with HTTPie Source: https://github.com/httpie/cli/blob/master/README.md This example demonstrates the simplest way to send a GET request to a URL using HTTPie. It fetches the content from the specified endpoint, `httpie.io/hello`. ```bash https httpie.io/hello ``` -------------------------------- ### Installing HTTPie via dnf (Fedora Linux) Source: https://github.com/httpie/cli/blob/master/docs/README.md Installs HTTPie on Fedora Linux using the `dnf` package manager. The command installs the httpie package. ```bash $ dnf install httpie ``` -------------------------------- ### Installing HTTPie via PyPI (Python) Source: https://github.com/httpie/cli/blob/master/docs/README.md Installs HTTPie using Python's pip package manager. This method requires Python 3.7 or newer. It first upgrades pip and wheel, then installs the httpie package. ```bash $ python -m pip install --upgrade pip wheel $ python -m pip install httpie ``` -------------------------------- ### Installing HTTPie via Linuxbrew (Linux) Source: https://github.com/httpie/cli/blob/master/docs/README.md Installs HTTPie on Linux using the Linuxbrew package manager. Requires Linuxbrew to be installed. The command first updates Linuxbrew, then installs the httpie package. ```bash $ brew update $ brew install httpie ``` -------------------------------- ### Installing Unstable HTTPie via Homebrew Source: https://github.com/httpie/cli/blob/master/docs/README.md These commands install the development (unstable) version of HTTPie on macOS and Linux using Homebrew. The first command uninstalls any existing HTTPie installation, and the second installs the latest version from the `HEAD` of the repository. ```bash $ brew uninstall --force httpie $ brew install --HEAD httpie ``` -------------------------------- ### Upgrading HTTPie Plugins (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command upgrades an already installed HTTPie plugin to its latest available version. The example shows how to upgrade httpie-plugin. ```bash $ httpie cli plugins upgrade httpie-plugin ``` -------------------------------- ### Generating API Documentation Example (MOVE) - HTTPie Bash Source: https://github.com/httpie/cli/blob/master/docs/README.md Illustrates using HTTPie's `--offline` mode to generate a MOVE request for API documentation without sending it. This example moves a piece in an existing chess game. ```bash $ http --offline MOVE server.chess/api/games/123 API-Key:ZZZ p=b a=R1a3 t=77 ``` -------------------------------- ### Installing HTTPie via Homebrew (macOS) Source: https://github.com/httpie/cli/blob/master/docs/README.md Installs HTTPie on macOS using the Homebrew package manager. Requires Homebrew to be installed. The command first updates Homebrew, then installs the httpie package. ```bash $ brew update $ brew install httpie ``` -------------------------------- ### Developing and Testing HTTPie Chocolatey Package (Bash) Source: https://github.com/httpie/cli/blob/master/docs/packaging/windows-chocolatey/README.md This comprehensive set of Bash commands outlines the development workflow for the HTTPie Chocolatey package. It includes cloning the repository, navigating to the packaging directory, building the package, checking its metadata, installing it locally for testing, verifying the installed `http` and `https` commands, and finally uninstalling the package. ```bash # Clone git clone --depth=1 https://github.com/httpie/cli.git cd httpie/docs/packaging/windows-chocolatey # Build choco pack # Check metadata choco info httpie -s . # Install choco install httpie -y -dv -s "'.;https://community.chocolatey.org/api/v2/'" # Test http --version https --version # Remove choco uninstall -y httpie ``` -------------------------------- ### Setting Up Development Environment - Git Bash Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md These commands guide the user through cloning their forked HTTPie repository, navigating into the project directory, and creating a new Git branch for their specific changes. This ensures an isolated environment for development. ```bash # Clone your fork $ git clone git@github.com:/httpie.git # Enter the project directory $ cd httpie # Create a branch for your changes $ git checkout -b my_topical_branch ``` -------------------------------- ### Example Output of HTTPie Response Headers and Metadata Source: https://github.com/httpie/cli/blob/master/docs/README.md This is an example of the combined output when using `--print=hm`, showing the HTTP response headers followed by the elapsed time metadata. It illustrates how different output parts can be combined. ```http HTTP/1.1 200 OK Content-Type: application/json Elapsed time: 0.077538375s ``` -------------------------------- ### Example Output of HTTPie Response Metadata Source: https://github.com/httpie/cli/blob/master/docs/README.md This is an example of the output generated when using the `--meta` option, showing the elapsed time for the HTTP request. This metadata provides insight into the performance of the request. ```console Elapsed time: 1.099171542s ``` -------------------------------- ### Installing HTTPie via MacPorts (macOS) Source: https://github.com/httpie/cli/blob/master/docs/README.md Installs HTTPie on macOS using the MacPorts package manager. Requires MacPorts to be installed. The command first updates MacPorts, then installs the httpie package. ```bash $ port selfupdate $ port install httpie ``` -------------------------------- ### Installing Unstable HTTPie via pip Source: https://github.com/httpie/cli/blob/master/docs/README.md This command installs or upgrades the development (unstable) version of HTTPie directly from the `master` branch on GitHub using `pip`. It's suitable for Linux, macOS, Windows, and FreeBSD, but may not be as reliable as stable releases. ```bash $ python -m pip install --upgrade https://github.com/httpie/cli/archive/master.tar.gz ``` -------------------------------- ### Running HTTPie Benchmarks (Shell) Source: https://github.com/httpie/cli/blob/master/extras/profiling/README.md Executes the HTTPie benchmarking script from the command line. This command initializes isolated environments, installs HTTPie from the latest commit and the master branch, runs benchmarks on both, and compares the results, printing them as a markdown table. It supports options for fresh clones (`--fresh`), custom branches/repos (`--local-repo`, `--target-branch`, `--target-repo`), and additional dependencies (`--complex`). ```Shell python extras/profiling/run.py ``` -------------------------------- ### Basic HTTPS Request with HTTPie Source: https://github.com/httpie/cli/blob/master/docs/README.md This command performs a simple `GET` request to `httpie.io/hello` using the `https` executable, which defaults to the `https://` scheme. It demonstrates a basic 'Hello World' interaction. ```bash $ https httpie.io/hello ``` -------------------------------- ### Example HTTPie Configuration with Default Options (JSON) Source: https://github.com/httpie/cli/blob/master/docs/README.md This JSON snippet illustrates how to configure `default_options` in the `config.json` file. It sets a default style for all HTTPie invocations, ensuring consistent output theming without needing to specify the option every time. ```json { "default_options": [ "--style=fruity" ] } ``` -------------------------------- ### Installing Latest Stable HTTPie on Fedora (Bash) Source: https://github.com/httpie/cli/blob/master/docs/packaging/linux-fedora/README.md This command installs the latest stable version of HTTPie on Fedora using `dnf`. It's important to note that `yum` is an alias for `dnf` on Fedora. This command assumes the latest stable version has already been propagated to the Fedora repositories. ```Bash # Note that yum is an alias to dnf. $ sudo dnf install httpie ``` -------------------------------- ### Upgrading HTTPie via Snapcraft (Linux) Source: https://github.com/httpie/cli/blob/master/docs/README.md Upgrades an existing HTTPie installation on Linux using the Snapcraft package manager. The command refreshes the httpie snap to its latest version. ```bash $ snap refresh httpie ``` -------------------------------- ### Upgrading HTTPie via pacman (Arch Linux) Source: https://github.com/httpie/cli/blob/master/docs/README.md Upgrades an existing HTTPie installation on Arch Linux and its derivatives using the `pacman` package manager. The command synchronizes package databases and upgrades all installed packages. ```bash $ pacman -Syu ``` -------------------------------- ### Example HTTP POST Request Syntax Source: https://github.com/httpie/cli/blob/master/docs/README.md This snippet illustrates the raw HTTP syntax for a POST request. It includes common headers such as Host, X-API-Key, User-Agent, and Content-Type, followed by the URL-encoded request body. This serves as a comparison point for HTTPie's simplified command-line syntax. ```http POST /post HTTP/1.1 Host: pie.dev X-API-Key: 123 User-Agent: Bacon/1.0 Content-Type: application/x-www-form-urlencoded name=value&name2=value2 ``` -------------------------------- ### Upgrading HTTPie Single Binary (Linux) Source: https://github.com/httpie/cli/blob/master/docs/README.md Upgrades an existing HTTPie single binary installation on Linux. This method downloads the latest binary, overwriting the previous version. ```bash $ https --download packages.httpie.io/binaries/linux/http-latest -o http ``` -------------------------------- ### Sending GET Request with Body Source: https://github.com/httpie/cli/blob/master/docs/README.md This command sends an HTTP `GET` request to `pie.dev/get` that includes a request body (`hello=world`). While uncommon, HTTPie supports sending bodies with `GET` requests. ```bash $ http GET pie.dev/get hello=world ``` -------------------------------- ### Verifying HTTPie Version Source: https://github.com/httpie/cli/blob/master/docs/README.md This command checks the installed version of HTTPie. When checking an unstable version, the output will typically include a `.dev0` suffix, indicating it's a development build. ```bash $ http --version # 3.X.X.dev0 ``` -------------------------------- ### Example Request with Custom Headers - HTTP Source: https://github.com/httpie/cli/blob/master/docs/README.md This HTTP snippet displays the full request including the custom headers set by the previous HTTPie command. It shows how `Accept`, `Accept-Encoding`, `Cookie`, `Host`, `Referer`, `User-Agent`, and `X-Foo` headers are structured in the request. ```http GET /headers HTTP/1.1 Accept: */* Accept-Encoding: gzip, deflate Cookie: valued-visitor=yes;foo=bar Host: pie.dev Referer: https://httpie.org/ User-Agent: Bacon/1.0 X-Foo: Bar ``` -------------------------------- ### Piping HTTPie Output to ImageMagick and Uploading (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This advanced example demonstrates chaining HTTPie with ImageMagick using pipes. It downloads an image, resizes it to 25% using `convert`, and then uploads the modified image to another URL, showcasing powerful command-line data processing. ```bash $ http octodex.github.com/images/original.jpg | convert - -resize 25% - | http example.org/Octocats ``` -------------------------------- ### HTTPie Download Mode Output Example (HTTP) Source: https://github.com/httpie/cli/blob/master/docs/README.md This snippet illustrates the typical output of HTTPie when operating in download mode. It shows the HTTP response headers, followed by a progress bar indicating the download status, file size, and transfer rate, confirming the successful saving of the file. ```http HTTP/1.1 200 OK Content-Disposition: attachment; filename=httpie-master.tar.gz Content-Length: 257336 Content-Type: application/x-gzip Downloading 251.30 kB to "httpie-master.tar.gz" Done. 251.30 kB in 2.73862s (91.76 kB/s) ``` -------------------------------- ### Activating Python Virtual Environment - Bash Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md This command activates the Python virtual environment created during the setup process for the current shell session. Activating the environment ensures that `http` and other Python commands point to the development copy and its dependencies. ```bash $ source venv/bin/activate ``` -------------------------------- ### Upgrading HTTPie via apt (Debian/Ubuntu Linux) Source: https://github.com/httpie/cli/blob/master/docs/README.md Upgrades an existing HTTPie installation on Debian-derived Linux distributions using `apt`. It updates the package list and then upgrades the httpie package. ```bash $ sudo apt update && sudo apt upgrade httpie ``` -------------------------------- ### Installing HTTPie in Editable Mode (PowerShell) Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md Installs HTTPie in editable mode along with all development dependencies within the active virtual environment. This allows for direct code modifications to be reflected without reinstallation. ```powershell C:\> python -m pip install --upgrade -e .[dev] ``` -------------------------------- ### Activating HTTPie Virtual Environment (PowerShell) Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md Activates the previously created 'venv' virtual environment on Windows, making its Python and installed packages available in the current shell session. ```powershell C:\> venv\Scripts\activate ``` -------------------------------- ### HTTP Request-Line Example Source: https://github.com/httpie/cli/blob/master/docs/README.md This snippet shows the actual `Request-Line` format for an HTTP `DELETE` request, illustrating how the method and path are structured before the HTTP version. ```http DELETE /delete HTTP/1.1 ``` -------------------------------- ### Viewing Request Details with HTTPie Source: https://github.com/httpie/cli/blob/master/docs/README.md This command sends a `GET` request to `pie.dev/get` and uses the `-v` (verbose) flag to print the request and response headers and body, allowing inspection of the communication. ```bash $ http -v pie.dev/get ``` -------------------------------- ### Verifying HTTPie Command Path (PowerShell) Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md Checks the command path for 'http' in PowerShell to ensure it points to the development copy within the virtual environment, confirming successful setup. ```powershell (httpie) PS C:\Users\\httpie> Get-Command http ``` -------------------------------- ### Upgrading HTTPie via Chocolatey (Windows) Source: https://github.com/httpie/cli/blob/master/docs/README.md Upgrades an existing HTTPie installation on Windows using the Chocolatey package manager. The command upgrades the httpie package. ```bash $ choco upgrade httpie ``` -------------------------------- ### Generating Verbose HTTP Exchange Output with HTTPie Source: https://github.com/httpie/cli/blob/master/docs/README.md This snippet demonstrates the `--verbose` option, which prints the entire HTTP exchange, including both the request and response details. It's highly useful for debugging and generating comprehensive documentation examples of API interactions. ```bash $ http --verbose PUT pie.dev/put hello=world ``` ```http PUT /put HTTP/1.1 Accept: application/json, */*;q=0.5 Accept-Encoding: gzip, deflate Content-Type: application/json Host: pie.dev User-Agent: HTTPie/0.2.7dev { "hello": "world" } HTTP/1.1 200 OK Connection: keep-alive Content-Length: 477 Content-Type: application/json Date: Sun, 05 Aug 2012 00:25:23 GMT Server: gunicorn/0.13.4 { […] } ``` -------------------------------- ### Upgrading HTTPie via PyPI (Python) Source: https://github.com/httpie/cli/blob/master/docs/README.md Upgrades an existing HTTPie installation using Python's pip package manager. It ensures pip and wheel are up-to-date before upgrading the httpie package. ```bash $ python -m pip install --upgrade pip wheel $ python -m pip install --upgrade httpie ``` -------------------------------- ### HTTP Request for Localhost Root Source: https://github.com/httpie/cli/blob/master/docs/README.md Shows the HTTP GET request for the `http :` shorthand. The request targets the root path `/` on `localhost` with the default HTTP port, confirming the expansion of the simplest localhost shortcut. ```http GET / HTTP/1.1 Host: localhost ``` -------------------------------- ### Upgrading HTTPie via Linuxbrew (Linux) Source: https://github.com/httpie/cli/blob/master/docs/README.md Upgrades an existing HTTPie installation on Linux using the Linuxbrew package manager. It updates Linuxbrew, then upgrades the httpie package. ```bash $ brew update $ brew upgrade httpie ``` -------------------------------- ### HTTP Request with Querystring Parameters Source: https://github.com/httpie/cli/blob/master/docs/README.md Displays the resulting HTTP GET request with querystring parameters `q=httpie` and `per_page=1`. This is the HTTP representation of the request generated by HTTPie using the `param==value` syntax, showing how parameters are appended to the URL. ```http GET /search/repositories?q=httpie&per_page=1 HTTP/1.1 ``` -------------------------------- ### Upgrading HTTPie via Homebrew (macOS) Source: https://github.com/httpie/cli/blob/master/docs/README.md Upgrades an existing HTTPie installation on macOS using the Homebrew package manager. It updates Homebrew, then upgrades the httpie package. ```bash $ brew update $ brew upgrade httpie ``` -------------------------------- ### Extra Verbose Output with HTTPie (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command demonstrates how to use the `-vv` or `--verbose --verbose` option with HTTPie to get extra verbose output, including response metadata and additional columns like total elapsed time. It sends a GET request to `pie.dev/get`. ```bash $ http -vv pie.dev/get ``` -------------------------------- ### Launching Ubuntu Docker Image for Snapcraft Development Source: https://github.com/httpie/cli/blob/master/docs/packaging/snapcraft/README.md This snippet demonstrates how to pull the latest Ubuntu Docker image and then run it in an interactive, ephemeral container. This sets up the isolated environment required for further development and packaging tasks related to Snapcraft. ```bash docker pull ubuntu/latest docker run -it --rm ubuntu/latest ``` -------------------------------- ### Example Multipart Request with Custom Boundary - HTTP Source: https://github.com/httpie/cli/blob/master/docs/README.md This HTTP snippet illustrates a `multipart/form-data` request where a custom boundary (`xoxo`) has been specified. It shows how the `Content-Type` header and the multipart body are constructed with the custom boundary. ```http POST / HTTP/1.1 Content-Length: 129 Content-Type: multipart/form-data; boundary=xoxo Host: example.org --xoxo Content-Disposition: form-data; name="hello" world --xoxo-- ``` -------------------------------- ### Example Multipart Request Body - HTTP Source: https://github.com/httpie/cli/blob/master/docs/README.md This HTTP snippet shows the structure of a `multipart/form-data` request generated by HTTPie when using the `--multipart` flag. It includes the `Content-Type` header with a generated boundary and the form data for the `hello` field. ```http POST / HTTP/1.1 Content-Length: 129 Content-Type: multipart/form-data; boundary=c31279ab254f40aeb06df32b433cbccb Host: example.org --c31279ab254f40aeb06df32b433cbccb Content-Disposition: form-data; name="hello" world --c31279ab254f40aeb06df32b433cbccb-- ``` -------------------------------- ### Demonstrating HTTPie Syntax Error Guidance (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md Illustrates HTTPie's helpful error messages when a syntax error, such as an unclosed bracket, occurs in the request. The error message points to the exact location of the syntax issue, guiding the user to a quick fix. ```bash http --offline --print=B pie.dev/post \ 'foo[bar]=OK' \ 'foo[baz][quux=FAIL' ``` -------------------------------- ### Upgrading HTTPie via dnf (Fedora Linux) Source: https://github.com/httpie/cli/blob/master/docs/README.md Upgrades an existing HTTPie installation on Fedora Linux using the `dnf` package manager. The command upgrades the httpie package. ```bash $ dnf upgrade httpie ``` -------------------------------- ### Checking for HTTPie CLI Updates (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command checks for available updates for the HTTPie CLI application. It's a simple way to ensure your HTTPie installation is up-to-date. ```bash $ httpie cli check-updates ``` -------------------------------- ### Displaying Only Response Metadata with HTTPie Source: https://github.com/httpie/cli/blob/master/docs/README.md This example demonstrates using the `--meta` option to print only the response metadata, which currently includes the total elapsed time for the HTTP exchange. This is analogous to `--headers` or `--body` for specific output parts. ```bash $ http --meta pie.dev/delay/1 ``` -------------------------------- ### Implicit GET Request without Body Source: https://github.com/httpie/cli/blob/master/docs/README.md This command sends a `GET` request to `pie.dev/get` without explicitly specifying the `GET` method. HTTPie defaults to `GET` when no request body is present. ```bash $ http pie.dev/get ``` -------------------------------- ### Upgrading HTTPie via yum (CentOS/RHEL Linux) Source: https://github.com/httpie/cli/blob/master/docs/README.md Upgrades an existing HTTPie installation on CentOS and RHEL-derived Linux distributions using `yum`. The command upgrades the httpie package. ```bash $ yum upgrade httpie ``` -------------------------------- ### Setting Custom HTTP Headers - HTTPie - Bash Source: https://github.com/httpie/cli/blob/master/docs/README.md This command shows how to set multiple custom HTTP headers using HTTPie's `Header:Value` syntax. It includes examples for `User-Agent`, `Cookie`, `X-Foo`, and `Referer` headers, demonstrating various value types and quoting. ```bash $ http pie.dev/headers User-Agent:Bacon/1.0 'Cookie:valued-visitor=yes;foo=bar' \ X-Foo:Bar Referer:https://httpie.org/ ``` -------------------------------- ### Upgrading HTTPie via MacPorts (macOS) Source: https://github.com/httpie/cli/blob/master/docs/README.md Upgrades an existing HTTPie installation on macOS using the MacPorts package manager. It updates MacPorts, then upgrades the httpie package. ```bash $ port selfupdate $ port upgrade httpie ``` -------------------------------- ### Example Raw HTTP Request with Multiple Cookies - HTTP Source: https://github.com/httpie/cli/blob/master/docs/README.md Shows the raw HTTP request format when sending multiple cookies. This is the underlying HTTP message generated by HTTPie for the previous command. ```http GET / HTTP/1.1 Accept: */* Accept-Encoding: gzip, deflate Connection: keep-alive Cookie: sessionid=foo;another-cookie=bar Host: pie.dev User-Agent: HTTPie/0.9.9 ``` -------------------------------- ### Creating Top-Level JSON Arrays with HTTPie (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md Illustrates how to construct a top-level JSON array by omitting the starting key and using the `[]:=` syntax to append elements. This creates a simple array of scalar values. ```bash $ http --offline --print=B pie.dev/post \ []:=1 \ []:=2 \ []:=3 ``` -------------------------------- ### Viewing Intermediary Requests/Responses with HTTPie (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command uses the `--all` option along with `--follow` to display all HTTP communication, including intermediary requests and responses, such as those from redirects. It sends a GET request to `pie.dev/redirect/3`. ```bash $ http --all --follow pie.dev/redirect/3 ``` -------------------------------- ### Example Request with Multiple Same-Name Headers - HTTP Source: https://github.com/httpie/cli/blob/master/docs/README.md This HTTP snippet shows the resulting request when multiple headers with the same name are provided. HTTPie sends each `Cookie` header as a distinct line, adhering to HTTP specifications for repeated headers. ```http GET / HTTP/1.1 Cookie: one Cookie: two ``` -------------------------------- ### Processing Streamed Output Line by Line (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This advanced example demonstrates how to process each new line (JSON object) from a streaming API (`pie.dev/stream/3`) as soon as it arrives. The `--stream` flag ensures immediate flushing, and the `while read line` loop pipes each line to another HTTPie request, effectively sending it to `pie.dev/post`. ```bash $ http --stream pie.dev/stream/3 | while read line; do echo "$line" | http pie.dev/post ; done ``` -------------------------------- ### Upgrading HTTPie using pkg Source: https://github.com/httpie/cli/blob/master/docs/README.md This command upgrades the HTTPie package using the `pkg` package manager, specifically for systems that use `www/py-httpie` as the package name. It ensures you have the latest stable version installed. ```bash $ pkg upgrade www/py-httpie ``` -------------------------------- ### Generated HTTP Request for Simple JSON Data (HTTP) Source: https://github.com/httpie/cli/blob/master/docs/README.md Displays the full HTTP request generated by HTTPie for the simple JSON data submission example. It highlights the automatically set Accept and Content-Type: application/json headers, confirming HTTPie's default behavior for JSON. ```http PUT / HTTP/1.1 Accept: application/json, */*;q=0.5 Accept-Encoding: gzip, deflate Content-Type: application/json Host: pie.dev { "name": "John", "email": "john@example.org" } ``` -------------------------------- ### Checking Code Style Compliance - Make Bash Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md This command runs checks to ensure that the codebase adheres to PEP8 (Style Guide for Python Code) compliance. It helps maintain consistent code style across the project. ```bash $ make codestyle ``` -------------------------------- ### Verifying Virtual Environment Activation - Bash Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md These commands demonstrate how to verify that the Python virtual environment is correctly activated. Checking `which http` confirms the command points to the development copy, and `http --version` shows the development version. ```bash (httpie) ~/Code/httpie $ which http /Users//Code/httpie/venv/bin/http (httpie) ~/Code/httpie $ http --version 2.0.0-dev ``` -------------------------------- ### Chaining HTTPie Requests via Piping (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command illustrates how to chain two HTTPie requests using a pipe. The output of the first GET request to GitHub API is used as the raw request body for the second POST request to `pie.dev/post`. ```bash $ http GET https://api.github.com/repos/httpie/cli | http POST pie.dev/post ``` -------------------------------- ### Exporting HTTPie CLI Parser Specification (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command exports the parser specification of http/https commands, which can be used by external tools for features like auto-completion. The example pipes the output to jq to extract and display the program name and version from the JSON output. ```bash $ httpie cli export-args | jq '"Program: " + .spec.name + ", Version: " + .version' ``` -------------------------------- ### Example Raw HTTP Request with Single Cookie - HTTP Source: https://github.com/httpie/cli/blob/master/docs/README.md Illustrates the raw HTTP request format when sending a single cookie. This is the underlying HTTP message generated by HTTPie for the previous command. ```http GET / HTTP/1.1 Accept: */* Accept-Encoding: gzip, deflate Connection: keep-alive Cookie: sessionid=foo Host: pie.dev User-Agent: HTTPie/0.9.9 ``` -------------------------------- ### Explicit GET Request without Body Source: https://github.com/httpie/cli/blob/master/docs/README.md This command explicitly sends a `GET` request to `pie.dev/get`. Since no request data is provided, HTTPie defaults to `GET` even if the method is omitted. ```bash $ http GET pie.dev/get ``` -------------------------------- ### Custom Method, Headers, and JSON Data Source: https://github.com/httpie/cli/blob/master/docs/README.md This example demonstrates how to send a `PUT` request with a custom HTTP header (`X-API-Token`) and JSON data (`name=John`) to `pie.dev/put`. HTTPie automatically infers JSON for `name=John`. ```bash $ http PUT pie.dev/put X-API-Token:123 name=John ``` -------------------------------- ### HTTP Request for Localhost Default Port Source: https://github.com/httpie/cli/blob/master/docs/README.md Shows the resulting HTTP GET request for the `:/foo` shorthand. The request targets `/foo` on `localhost` with the default HTTP port (80) implied, illustrating how HTTPie expands the localhost shortcut. ```http GET /foo HTTP/1.1 Host: localhost ``` -------------------------------- ### Specifying SSL Ciphers with HTTPie Source: https://github.com/httpie/cli/blob/master/docs/README.md This example shows how to specify a custom list of available ciphers using the `--ciphers` option. The value must be a string in the OpenSSL cipher list format, allowing fine-grained control over the cryptographic suites used for secure connections. ```bash $ http --ciphers=ECDHE-RSA-AES128-GCM-SHA256 https://pie.dev/get ``` -------------------------------- ### Normalized HTTP Request Path Source: https://github.com/httpie/cli/blob/master/docs/README.md Displays the HTTP GET request with the path normalized by HTTPie. The original path `/./../../etc/password` is resolved to `/etc/password`, showing the effect of default path normalization. ```http GET /etc/password HTTP/1.1 ``` -------------------------------- ### Implicit HTTP Scheme for Requests Source: https://github.com/httpie/cli/blob/master/docs/README.md This command sends a request to `example.org`. HTTPie automatically prepends `http://` to the URL if no scheme is specified, making it convenient for common web requests. ```bash $ http example.org # → http://example.org ``` -------------------------------- ### Creating Deeply Nested JSON Objects with HTTPie (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md A comprehensive example demonstrating the creation of a very deeply nested JSON object using various HTTPie syntaxes, including shallow key-value pairs, nested objects, indexed arrays, and deeply nested array appends. ```bash $ http PUT pie.dev/put \ shallow=value \ object[key]=value \ array[]:=1 \ array[1]:=2 \ array[2]:=3 \ very[nested][json][3][httpie][power][]=Amaze ``` -------------------------------- ### Uninstalling HTTPie Plugins (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command uninstalls a specified HTTPie plugin from the isolated plugins directory. It only uninstalls plugins that were originally installed using httpie cli plugins install. ```bash $ httpie cli plugins uninstall httpie-plugin ``` -------------------------------- ### HTTPie Command Synopsis Source: https://github.com/httpie/cli/blob/master/docs/README.md This is the general syntax for using the `http` command. It shows the order of optional flags, HTTP method, the required URL, and optional request items (data or headers). ```bash $ http [flags] [METHOD] URL [ITEM [ITEM]] ``` -------------------------------- ### Sending Raw Request Body with HTTPie (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md Demonstrates using the `--raw` option in HTTPie to send a literal string as the request body. This method is an alternative to `stdin` piping, useful for generating API documentation examples or when direct string input is preferred. ```bash $ http --raw 'Hello, world!' pie.dev/post $ http --raw '{"name": "John"}' pie.dev/post ``` -------------------------------- ### HTTPie Localhost Root Shortcut Source: https://github.com/httpie/cli/blob/master/docs/README.md Demonstrates the simplest localhost shorthand `:`. This expands to `http://localhost/`, making it easy to send requests to the root path of a local web server running on the default HTTP port. ```bash $ http : ``` -------------------------------- ### Handling Dash-Prefixed Fields and Headers in HTTPie (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md Shows how to correctly specify request items (data fields or headers) that start with a hyphen (-) in HTTPie. The -- special token is used to separate HTTPie arguments from request items, preventing misinterpretation of the items as command-line options. ```bash $ http pie.dev/post -- -name-starting-with-dash=foo -Unusual-Header:bar ``` -------------------------------- ### Building and Printing an Offline HTTP Request with HTTPie Source: https://github.com/httpie/cli/blob/master/README.md This example shows how to use HTTPie's `--offline` mode to construct and display an HTTP request without actually sending it over the network. This feature is useful for debugging, inspecting request structure, or generating requests for documentation. ```bash http --offline pie.dev/post hello=offline ``` -------------------------------- ### Example Nested JSON Request Body Source: https://github.com/httpie/cli/blob/master/docs/README.md This JSON snippet shows the final structure of the request body generated by HTTPie when using the nested JSON syntax. It clearly illustrates how the path declarations in the command line translate into a hierarchical JSON object with nested arrays and objects. ```json { "platform": { "name": "HTTPie", "about": { "mission": "Make APIs simple and intuitive", "homepage": "httpie.io", "stars": 54000 }, "apps": [ "Terminal", "Desktop", "Web", "Mobile" ] } } ``` -------------------------------- ### Resuming Partial Downloads with HTTPie (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command resumes a partial download of `file.zip` from `example.org/file`. It uses the shorthand `-dco` which combines `--download`, `--continue`, and `--output`. This feature requires the server to support `Range` requests and `206 Partial Content` responses. ```bash $ http -dco file.zip example.org/file ``` -------------------------------- ### Configuring Proxies for HTTP and HTTPS (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command specifies different proxy servers for HTTP and HTTPS protocols using the `--proxy` argument. It directs HTTP traffic through `http://10.10.1.10:3128` and HTTPS traffic through `https://10.10.1.10:1080` when accessing `example.org`. ```bash $ http --proxy=http:http://10.10.1.10:3128 --proxy=https:https://10.10.1.10:1080 example.org ``` -------------------------------- ### Configuring Proxy with Basic Authentication (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command shows how to include basic authentication credentials directly within the proxy URL using the format `user:pass@host:port`. The request to `example.org` will be routed through the authenticated HTTP proxy at `10.10.1.10:3128`. ```bash $ http --proxy=http:http://user:pass@10.10.1.10:3128 example.org ``` -------------------------------- ### Running Specific Pytest Tests - Bash Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md These commands illustrate how to run specific tests using `pytest` from the command line after activating the virtual environment. Users can target individual test files, test classes, or even specific test methods for focused testing. ```bash $ python -m pytest tests/test_uploads.py $ python -m pytest tests/test_uploads.py::TestMultipartFormDataFileUpload $ python -m pytest tests/test_uploads.py::TestMultipartFormDataFileUpload::test_upload_ok ``` -------------------------------- ### Converting URL to HTTPie Call with HTTP Source: https://github.com/httpie/cli/blob/master/docs/README.md Illustrates converting a URL into an HTTPie call using the `http` command. Similar to `https`, adding a space after the protocol name (`http ://`) allows HTTPie to automatically form a request to `http://example.org`, streamlining URL input. ```bash $ http ://example.org # → http://example.org ``` -------------------------------- ### Running All Tests - Make Bash Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md This command executes the entire test suite for the HTTPie project using the current Python interpreter. It also includes coverage reporting to assess test coverage. ```bash $ make test ``` -------------------------------- ### Verifying HTTPie Command Path and Version (CMD/Bash) Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md Checks the command path for 'http' and its version in CMD or Bash, ensuring it points to the development copy within the virtual environment and displays the correct development version. ```bash (httpie) C:\Users\\httpie> where http C:\Users\\httpie\venv\Scripts\http.exe C:\Users\\AppData\Local\Programs\Python\Python38-32\Scripts\http.exe ``` ```bash (httpie) C:\Users\\httpie> http --version 2.3.0-dev ``` -------------------------------- ### Implicit HTTPS Scheme for Requests Source: https://github.com/httpie/cli/blob/master/docs/README.md This command sends a request to `example.org` using the `https` executable. When using `https`, HTTPie automatically prepends `https://` to the URL if no scheme is specified, ensuring secure communication. ```bash $ https example.org ``` -------------------------------- ### Converting URL to HTTPie Call with HTTPS Source: https://github.com/httpie/cli/blob/master/docs/README.md Demonstrates how to quickly convert a URL into an HTTPie call using the `https` command. By adding a space after the protocol name (`https ://`), HTTPie automatically constructs the request to `https://example.org`. This simplifies pasting URLs directly into the terminal. ```bash $ https ://example.org # → https://example.org ``` -------------------------------- ### Downloading a File in HTTPie Download Mode (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command initiates a file download using HTTPie's dedicated download mode (`--download`). It fetches the specified URL, displays response headers and a progress bar on stderr, and saves the response body to a file named automatically based on the `Content-Disposition` header or URL. ```bash $ http --download https://github.com/httpie/cli/archive/master.tar.gz ``` -------------------------------- ### Printing Response Headers and Metadata with HTTPie Source: https://github.com/httpie/cli/blob/master/docs/README.md This snippet shows how to combine output options using `--print=hm` to display both the response headers (`h`) and the response metadata (`m`). This provides a concise overview of the response and its timing. ```bash $ http --print=hm pie.dev/get ``` -------------------------------- ### Creating a Named Session with Authentication Source: https://github.com/httpie/cli/blob/master/docs/README.md This command initiates a named session called `logged-in` for `pie.dev`. It includes basic authentication (`-a username:password`) and sends an `API-Key` header, making these aspects persistent for subsequent requests within this session. ```bash $ http --session=logged-in -a username:password pie.dev/get API-Key:123 ``` -------------------------------- ### Example Request with Comma-Separated Header Value - HTTP Source: https://github.com/httpie/cli/blob/master/docs/README.md This HTTP snippet shows the request where a single header (`Numbers`) contains a comma-separated value. This illustrates how HTTPie formats such values into a single header line. ```http GET / HTTP/1.1 Numbers: one,two ``` -------------------------------- ### Creating a Different Named HTTPie Session (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command demonstrates how to create or switch to a different named session, 'user2'. It sets new authentication details and a custom header specific to this session, allowing for distinct session contexts. ```bash $ http --session=user2 -a user2:password pie.dev/get X-Bar:Foo ``` -------------------------------- ### HTTPie Localhost Shortcut (Specific Port) Source: https://github.com/httpie/cli/blob/master/docs/README.md Illustrates HTTPie's localhost shorthand with a specified port, where `:3000/bar` expands to `http://localhost:3000/bar`. This allows for quick requests to local services running on non-default ports. ```bash $ http :3000/bar ``` -------------------------------- ### Running Extended Tests - Make Bash Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md This command executes an extended set of tests, which includes checks for code quality, Markdown file syntax, and packaging integrity. It provides a more comprehensive validation of the project. ```bash $ make test-all ``` -------------------------------- ### Performing Basic Authentication - HTTPie Bash Source: https://github.com/httpie/cli/blob/master/docs/README.md Demonstrates how to perform Basic authentication using HTTPie by providing a `username:password` pair with the `-a` flag. This sends credentials to a basic auth endpoint. ```bash $ http -a username:password pie.dev/basic-auth/username/password ``` -------------------------------- ### HTTP Request for Localhost Specific Port Source: https://github.com/httpie/cli/blob/master/docs/README.md Displays the HTTP GET request generated by the `:3000/bar` shorthand. The request targets `/bar` on `localhost:3000`, confirming that HTTPie correctly interprets the specified port in the localhost shortcut. ```http GET /bar HTTP/1.1 Host: localhost:3000 ``` -------------------------------- ### Prompting for Password (Basic Auth) - HTTPie Bash Source: https://github.com/httpie/cli/blob/master/docs/README.md Demonstrates how HTTPie prompts for a password when only a username is provided with the `-a` flag for Basic authentication. This ensures secure password entry. ```bash $ http -a username pie.dev/basic-auth/username/password ``` -------------------------------- ### Viewing HTTPie Configuration File Content (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command displays the content of the HTTPie configuration file, typically located at `~/.config/httpie/config.json`. It's useful for inspecting current settings like `default_options` or `plugins_dir`. ```bash cat ~/.config/httpie/config.json ``` -------------------------------- ### Piping Clipboard Content with Pbpaste to HTTPie (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command, specific to macOS, uses `pbpaste` to retrieve the content of the clipboard and pipes it as the raw request body to HTTPie. The clipboard content is sent as the body of a PUT request to `pie.dev/put`. ```bash $ pbpaste | http PUT pie.dev/put ``` -------------------------------- ### Non-Normalized HTTP Request Path Source: https://github.com/httpie/cli/blob/master/docs/README.md Displays the HTTP GET request when path normalization is disabled. The path `/./../../etc/password` is sent as `/../../etc/password`, demonstrating that the `--path-as-is` option prevents dot segment squashing. ```http GET /../../etc/password HTTP/1.1 ``` -------------------------------- ### Creating a Named HTTPie Session (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command creates a new named session 'user1' for 'pie.dev'. It includes authentication credentials (user1:password) and a custom HTTP header (X-Foo:Bar), which will be persisted in the session file for future requests. ```bash $ http --session=user1 -a user1:password pie.dev/get X-Foo:Bar ``` -------------------------------- ### Viewing Formatted HTTPie Output with Less (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command forces HTTPie to apply full formatting and colors (`--pretty=all`) and display verbose request/response details (`--verbose`), then pipes the output to `less -R`. The `-R` flag ensures `less` correctly interprets the color escape sequences for enhanced readability. ```bash $ http --pretty=all --verbose pie.dev/get | less -R ``` -------------------------------- ### Running HTTPie Tests Locally (Bash) Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md Executes all local tests for HTTPie using `pytest` within the active virtual environment, ensuring the development copy functions correctly. ```bash $ python -m pytest ``` -------------------------------- ### Triggering HTTPie Type Safety Error (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md Demonstrates HTTPie's type safety mechanism, which prevents performing key-based access on an array or index-based access on an object. This example attempts to access an array using a key, resulting in a type error. ```bash http --offline --print=B pie.dev/post \ 'array[]:=1' \ 'array[]:=2' \ 'array[key]:=3' ``` -------------------------------- ### HTTPie Localhost Shortcut (Default Port) Source: https://github.com/httpie/cli/blob/master/docs/README.md Demonstrates HTTPie's localhost shorthand where `: /foo` expands to `http://localhost/foo`. When the port is omitted in the shorthand, HTTPie defaults to port 80, simplifying requests to local services. ```bash $ http :/foo ``` -------------------------------- ### Pushing HTTPie Package to Chocolatey Store (Bash) Source: https://github.com/httpie/cli/blob/master/docs/packaging/windows-chocolatey/README.md This command pushes the generated HTTPie Chocolatey package (`.nupkg` file) to the official Chocolatey package repository. It requires replacing the version number (e.g., 2.5.0) with the correct one and providing a valid API key for authentication to the push source. ```bash # Replace 2.5.0 with the correct version choco push httpie.2.5.0.nupkg -s https://push.chocolatey.org/ --api-key=API_KEY ``` -------------------------------- ### Running Tests with Coverage - Make Bash Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md This command specifically runs the test suite and generates a detailed coverage report, indicating which parts of the code are covered by tests. This is useful for identifying areas needing more test coverage. ```bash $ make test-cover ``` -------------------------------- ### Creating a Bash Shortcut for Paged HTTPie Output (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This Bash function, `httpless`, provides a convenient shortcut to invoke HTTPie with full formatting, colors, and paged output. It prints only headers and body (`--print=hb`) and pipes the result to `less -R`, making it ideal for interactive API exploration. ```bash function httpless { # `httpless example.org' http --pretty=all --print=hb "$@" | less -R; } ``` -------------------------------- ### Using a Client-Side SSL Certificate (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command provides a client-side SSL certificate for mutual TLS authentication using the `--cert` option. The `client.pem` file should contain both the client certificate and its private key. ```bash $ http --cert=client.pem https://example.org ``` -------------------------------- ### Downloading a File with HTTPie (Bash) Source: https://github.com/httpie/cli/blob/master/docs/README.md This command shows how to download a file using HTTPie by redirecting the response body to a local file. The `>` operator saves the raw binary data from the URL `pie.dev/image/png` into `image.png`. ```bash $ http pie.dev/image/png > image.png ``` -------------------------------- ### Making Request with Custom Scheme (Before Alias) Source: https://github.com/httpie/cli/blob/master/docs/README.md Illustrates making a request using a custom URL scheme (`http+unix`) before setting up an alias. This requires specifying the full scheme and path, such as for interacting with a Unix socket via the `httpie-unixsocket` plugin. ```bash # Before $ http http+unix://%2Fvar%2Frun%2Fdocker.sock/info ``` -------------------------------- ### Creating HTTPie Virtual Environment (PowerShell) Source: https://github.com/httpie/cli/blob/master/CONTRIBUTING.md Creates a new Python virtual environment named 'venv' with the prompt 'httpie' for isolating project dependencies on Windows. ```powershell C:\> python -m venv --prompt httpie venv ``` -------------------------------- ### Example HTTP Request Body with Non-String JSON Fields Source: https://github.com/httpie/cli/blob/master/docs/README.md This HTTP snippet shows the resulting JSON request body generated by HTTPie when using the `:=` and `:=@` syntax for non-string fields and file embedding. It illustrates how different data types and embedded files are serialized into the final JSON payload. ```http PUT /person/1 HTTP/1.1 Accept: application/json, */*;q=0.5 Content-Type: application/json Host: pie.dev { "age": 29, "hobbies": [ "http", "pies" ], "description": "John is a nice guy who likes pies.", "married": false, "name": "John", "favorite": { "tool": "HTTPie" }, "bookmarks": { "HTTPie": "https://httpie.org", } } ```