GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
1
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
mark.george
/
httpcat
Browse code
Fix wonky line breaks in license section
master
1 parent
1327bd2
commit
2e7b39a5b601fe19b3d29061d6484a5fec033ff1
Mark George
authored
on 14 Mar 2022
Patch
Showing
1 changed file
README.md
Ignore Space
Show notes
View
README.md
httpcat =============== A netcat like tool for analysing/mocking HTTP requests (from both server and client perspective). My first experiment with Go. ## Usage ``` httpcat [OPTIONS] <command> Application Options: -v, --verbose Show additional details --headers Show headers and request/status line only (default is everything) --bodies Show bodies only (default is everything) --nocolour Don't use colours (default is requests are blue and responses are red) --notimestamps Don't show timestamps Help Options: -h, --help Show this help message Available commands: client Send an HTTP request proxy Start a reverse HTTP logging proxy server Start a mock HTTP server version Display version ``` Get help about a specific command by adding `--help` after the command. Example: ``` httpcat client --help ``` ## Client Mode Sends a request to the specified server and displays the response. ### Usage ``` httpcat [OPTIONS] client [client-OPTIONS] Application Options: -v, --verbose Show additional details --headers Show headers and request/status line only (default is everything) --bodies Show bodies only (default is everything) --nocolour Don't use colours (default is requests are blue and responses are red) --notimestamps Don't show timestamps Help Options: -h, --help Show this help message [client command options] -u, --uri= The URI to send the request to --header= A header to add to request in the form name:value. Use multiple times for multiple headers. -m, --method= HTTP method for request (default: GET) -b, --body= Request body to send ``` ### Example ``` httpcat client --method POST --body TESTING --uri http://localhost:8080/api/testing ``` ## Server Mode Creates mock routes that listen on specific paths and return specific response bodies. Displays the details of any requests that it receives. ### Usage ``` httpcat [OPTIONS] server [server-OPTIONS] Application Options: -v, --verbose Show additional details --headers Show headers and request/status line only (default is everything) --bodies Show bodies only (default is everything) --nocolour Don't use colours (default is requests are blue and responses are red) --notimestamps Don't show timestamps Help Options: -h, --help Show this help message [server command options] -p, --port= Port to listen on. (default: 8080) -r, --route= Route which is made up of a path, a response body, and a response status, all separated by the pipe character. Repeat for additional routes. (default: /|testing|200) -c, --cors Enable Cross Origin Resource Sharing (CORS). -H, --header= A header to add to response in the form name:value. Repeat for additional headers. ``` ### Example ``` httpcat server --port 8080 --route "/hello|Hello World|200" --header "Content-Type:text/plain" ``` This creates a web server that listens on port 8080 and responds to any requests to the `/hello` path with the response `Hello World` and response code `200`. Repeat the `--route` option to add more routes. ## Proxy Mode Creates a reverse proxy that displays all HTTP requests and responses that pass through it. ### Usage ``` httpcat [OPTIONS] proxy [proxy-OPTIONS] Application Options: -v, --verbose Show additional details --headers Show headers and request/status line only (default is everything) --bodies Show bodies only (default is everything) --nocolour Don't use colours (default is requests are blue and responses are red) --notimestamps Don't show timestamps Help Options: -h, --help Show this help message [proxy command options] -p, --port= The port that the proxy listens on. -t, --target= ``` ### Example ``` httpcat proxy --port 8090 --target http://localhost:8080 ``` Any requests sent to port 8090 will be forwarded to `http://localhost:8080` and all requests and responses will be displayed. ## Building ``` cd src go build -o ../httpcat ``` ### Cross Compiling Linux ``` GOOS=linux GOARCH=amd64 go build -o ../httpcat-linux ``` Windows ``` GOOS=windows GOARCH=amd64 go build -o ../httpcat-win64 ``` Intel Mac ``` GOOS=darwin GOARCH=amd64 go build -o ../httpcat-mac-intel ``` M1/ARM64 Mac ``` GOOS=darwin GOARCH=arm64 go build -o ../httpcat-mac-arm64 ``` ## License Zero-Clause BSD License Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
httpcat =============== A netcat like tool for analysing/mocking HTTP requests (from both server and client perspective). My first experiment with Go. ## Usage ``` httpcat [OPTIONS] <command> Application Options: -v, --verbose Show additional details --headers Show headers and request/status line only (default is everything) --bodies Show bodies only (default is everything) --nocolour Don't use colours (default is requests are blue and responses are red) --notimestamps Don't show timestamps Help Options: -h, --help Show this help message Available commands: client Send an HTTP request proxy Start a reverse HTTP logging proxy server Start a mock HTTP server version Display version ``` Get help about a specific command by adding `--help` after the command. Example: ``` httpcat client --help ``` ## Client Mode Sends a request to the specified server and displays the response. ### Usage ``` httpcat [OPTIONS] client [client-OPTIONS] Application Options: -v, --verbose Show additional details --headers Show headers and request/status line only (default is everything) --bodies Show bodies only (default is everything) --nocolour Don't use colours (default is requests are blue and responses are red) --notimestamps Don't show timestamps Help Options: -h, --help Show this help message [client command options] -u, --uri= The URI to send the request to --header= A header to add to request in the form name:value. Use multiple times for multiple headers. -m, --method= HTTP method for request (default: GET) -b, --body= Request body to send ``` ### Example ``` httpcat client --method POST --body TESTING --uri http://localhost:8080/api/testing ``` ## Server Mode Creates mock routes that listen on specific paths and return specific response bodies. Displays the details of any requests that it receives. ### Usage ``` httpcat [OPTIONS] server [server-OPTIONS] Application Options: -v, --verbose Show additional details --headers Show headers and request/status line only (default is everything) --bodies Show bodies only (default is everything) --nocolour Don't use colours (default is requests are blue and responses are red) --notimestamps Don't show timestamps Help Options: -h, --help Show this help message [server command options] -p, --port= Port to listen on. (default: 8080) -r, --route= Route which is made up of a path, a response body, and a response status, all separated by the pipe character. Repeat for additional routes. (default: /|testing|200) -c, --cors Enable Cross Origin Resource Sharing (CORS). -H, --header= A header to add to response in the form name:value. Repeat for additional headers. ``` ### Example ``` httpcat server --port 8080 --route "/hello|Hello World|200" --header "Content-Type:text/plain" ``` This creates a web server that listens on port 8080 and responds to any requests to the `/hello` path with the response `Hello World` and response code `200`. Repeat the `--route` option to add more routes. ## Proxy Mode Creates a reverse proxy that displays all HTTP requests and responses that pass through it. ### Usage ``` httpcat [OPTIONS] proxy [proxy-OPTIONS] Application Options: -v, --verbose Show additional details --headers Show headers and request/status line only (default is everything) --bodies Show bodies only (default is everything) --nocolour Don't use colours (default is requests are blue and responses are red) --notimestamps Don't show timestamps Help Options: -h, --help Show this help message [proxy command options] -p, --port= The port that the proxy listens on. -t, --target= ``` ### Example ``` httpcat proxy --port 8090 --target http://localhost:8080 ``` Any requests sent to port 8090 will be forwarded to `http://localhost:8080` and all requests and responses will be displayed. ## Building ``` cd src go build -o ../httpcat ``` ### Cross Compiling Linux ``` GOOS=linux GOARCH=amd64 go build -o ../httpcat-linux ``` Windows ``` GOOS=windows GOARCH=amd64 go build -o ../httpcat-win64 ``` Intel Mac ``` GOOS=darwin GOARCH=amd64 go build -o ../httpcat-mac-intel ``` M1/ARM64 Mac ``` GOOS=darwin GOARCH=arm64 go build -o ../httpcat-mac-arm64 ``` ## License Zero-Clause BSD License Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Show line notes below