{"id":13586051,"url":"https://github.com/httpie/httpcat","last_synced_at":"2025-04-07T14:33:16.507Z","repository":{"id":62569653,"uuid":"76278380","full_name":"httpie/httpcat","owner":"httpie","description":" httpcat is a simple utility for constructing raw HTTP requests on the command line. ","archived":false,"fork":false,"pushed_at":"2024-10-31T22:38:55.000Z","size":26,"stargazers_count":227,"open_issues_count":0,"forks_count":29,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-10-31T23:25:17.339Z","etag":null,"topics":["api","api-testing","cli","command-line","debugging","http","httpie","python","terminal","utility"],"latest_commit_sha":null,"homepage":"https://httpie.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/httpie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jakubroztocil"}},"created_at":"2016-12-12T17:14:03.000Z","updated_at":"2024-10-31T22:39:00.000Z","dependencies_parsed_at":"2024-10-31T23:22:18.387Z","dependency_job_id":"93c381fa-d4f5-4529-b051-0688e0f5b072","html_url":"https://github.com/httpie/httpcat","commit_stats":{"total_commits":26,"total_committers":2,"mean_commits":13.0,"dds":"0.038461538461538436","last_synced_commit":"299422b598c1738acb16857dd0fcb32d53ba59c9"},"previous_names":["jkbrzt/httpcat"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/httpie%2Fhttpcat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/httpie%2Fhttpcat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/httpie%2Fhttpcat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/httpie%2Fhttpcat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/httpie","download_url":"https://codeload.github.com/httpie/httpcat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247670337,"owners_count":20976547,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-testing","cli","command-line","debugging","http","httpie","python","terminal","utility"],"created_at":"2024-08-01T15:05:17.898Z","updated_at":"2025-04-07T14:33:16.206Z","avatar_url":"https://github.com/httpie.png","language":"Python","readme":"# `httpcat`\n\n[![Build Status](https://github.com/jakubroztocil/httpcat/workflows/Test/badge.svg)](https://github.com/jakubroztocil/httpcat/actions)\n\n``httpcat`` is a simple utility for constructing raw HTTP\nrequests on the command line.\n\n\n## Why?\n\nSometimes it is useful to be able to create an actual raw \n[HTTP request](https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html)\non the  command line:\n \n* To debug a server issue\n* To test the handling of invalid HTTP requests\n* To learn how HTTP works under the hood\n\nIn such cases, existing CLI HTTP clients—such as \n[`httpie`](https://httpie.org),\n[`curl`](https://curl.haxx.se/), \nor [`wget`](https://www.gnu.org/software/wget/) \n—are too high-level as they provide\nan abstraction layer and one doesn't have a complete control over the \nexact raw data that gets written to the HTTP socket connection.\n\nLower-level tools, such as the popular \n[`netcat`](https://en.wikipedia.org/wiki/Netcat), are better suited for this \njob.\n\nHowever, the syntax of HTTP requires headers to be separated with \n`\\r\\n` which makes it difficult to produce them on the command line. \nA typical solution involves the use of `echo`:\n\n\n```bash\n$ echo -ne 'POST /post HTTP/1.1\\r\\nHost: httpbin.org\\r\\nContent-Length: 5\\r\\n\\r\\nHello' | \\\n    nc localhost 8000\n```\n\n`httpcat` makes this easier:\n\n\n## How it works\n\n1. Reads command arguments as lines and then lines from ``stdin``\n2. Auto-completes them, if necessary\n3. Writes them to ``stdout``\n\n\n## Features\n\n* Automatic ``\\r\\n`` completion\n* Automatic `Method` completion in `Request-Line`\n* Automatic `HTTP-Version` completion in `Request-Line`\n\n\n## Usage\n\nInteractively create a request and send it with `nc`:\n\n```bash\n$ httpcat -v | nc httpbin.org 80\nPOST /post HTTP/1.1\n\u003e POST /post HTTP/1.1\\r\\n\nHost: httpbin.org\n\u003e Host: httpbin.org\\r\\n\nContent-Length: 6\n\u003e Content-Length: 6\\r\\n\n\n\u003e \\r\\n\nHello\n\u003e Hello\n```\n\nSpecify the whole request in the arguments. Here `''` represents an empty\nline which will be converted to `\\r\\n\\` separating the headers and the \nbody. Note also that the omitted `HTTP-Version` is auto-completed:\n\n```bash\n$ httpcat -v 'POST /post' 'Host: httpbin.org' 'Content-Length: 5' '' 'Hello'  | nc httpbin.org 80\n\u003e POST /post HTTP/1.1\\r\\n\n\u003e Host: httpbin.org\\r\\n\n\u003e Content-Length: 5\\r\\n\n\u003e \\r\\n\n\u003e Hello\n\n```\n\nOmitted `Method` is set to `GET` and `HTTP-Version` is auto-completed:\n\n```bash\n$ httpcat -v / 'Host: example.org' '' | nc example.org 80\n\u003e GET / HTTP/1.1\\r\\n\n\u003e Host: example.org\\r\\n\n\u003e \\r\\n\n```\n\nYou can, for example, use `stdin` for data and arguments for headers: \n\n```bash\n$ cat file.txt | httpcat -v 'POST /post' 'Host: httpbin.org' 'Content-Length: 16' '' | nc httpbin.org 80\n\u003e POST /post HTTP/1.1\\r\\n\n\u003e Host: httpbin.org\\r\\n\n\u003e Content-Length: 16\\r\\n\n\u003e \\r\\n\n\u003e Hello from file\n```\n\nSee also `httpcat --help`:\n\n```\nusage: httpcat [-h] [-V, --version] [-v] [-n] [line [line ...]]\n\nCreate raw HTTP requests on the command line.\n\npositional arguments:\n  line            input lines read before lines from stdin\n\noptional arguments:\n  -h, --help      show this help message and exit\n  -V, --version   show program's version number and exit\n  -v, --verbose   print info about output lines to stderr\n  -n, --no-stdin  disable reading of lines from stdin\n```\n\n\n## Dependencies\n\n* Python 3\n\n\n## Installation\n\n\n```bash\npip3 install httpcat\n```\n\nAlternatively, you can just download `httpcat.py` manually and invoke \nit as `./httpcat.py` instead of `httpcat`. \n\n\n## Tests\n\n```bash\npython3 setup.py test\n```\n\n\n## HTTPie offline mode\n\n[HTTPie CLI](https://httpie.io/) starting with version 2.0.0 also provides an [`--offline` mode](https://httpie.io/docs/cli/offline-mode). This makes it a good alternative to `httpcat` because it provides a convenient mechanism for crafting arbitrary HTTP requests without sending them using the user-friendly HTTPie syntax, for example:\n\n```bash\necho -n 'Hello' | http --offline POST httpbin.org/post\n```\n\nThe above command generates the following output:\n\n```http\nPOST /post HTTP/1.1\nAccept: application/json, */*;q=0.5\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nContent-Length: 5\nContent-Type: application/json\nHost: httpbin.org\nUser-Agent: HTTPie/2.2.0\n\nHello\n```\n\nThe output is valid HTTP, so it can simply be sent using `nc`:\n\n```bash\n$ echo -n 'Hello' | http --offline POST httpbin.org/post | nc httpbin.org 80\n```\n\n## Changelog\n\n\n* `0.0.2` (2016-12-13)\n    * Added `-v, --verbose` and the command is more quiet by default.\n    * Added `-n, --no-stdin`\n    * Added `-h, --help` \n    * Added `-V, --version`\n\n* `0.0.1` (2016-12-12)\n   * Initial release.\n\n## Contact\n\nJakub Roztocil\n\n* [https://github.com/jkbrzt](https://github.com/jkbrzt)\n* [https://twitter.com/jkbrzt](https://twitter.com/jkbrzt)\n* [http://roztocil.co](http://roztocil.co)\n","funding_links":["https://github.com/sponsors/jakubroztocil"],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhttpie%2Fhttpcat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhttpie%2Fhttpcat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhttpie%2Fhttpcat/lists"}