diff --git a/README.md b/README.md index c8ea163..b270a77 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ A netcat-like tool for analysing or mocking HTTP requests. My first experiment with Go. +Latest version: 2.4 + ## Usage ``` @@ -128,7 +130,7 @@ ### Complex Bodies -For mocking real web services it can be annoying to include a large body directly in the route definition. A better option is to use shell command substitution to load the body from a file: +For mocking services with large/complex bodies, you can use shell command substitution to load the body for a route from a file: File `cust.json`: ``` @@ -176,16 +178,23 @@ -t, --target The URL for the target web server that the proxy forwards requests to. + +-f, --filter Only show bodies that match the given Content-Type. ``` -### Example +### Examples ``` httpcat proxy --port 8090 --target http://localhost:8080 + +# only show JSON bodies +httpcat proxy --filter "application/json" --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. Any redirect responses will be rewritten to use the specified port. +Using the `filter` option will cause the bodies that don't match the given `Content-Type` to be suppressed, but the headers will still be shown. + ## Building ``` @@ -199,7 +208,7 @@ go build -ldflags "-s -w" -o ../httpcat ``` -See the `link` docs for information on flags: +See the `link` docs for information on `ldflags`: https://pkg.go.dev/cmd/link @@ -214,7 +223,7 @@ Windows ``` -GOOS=windows GOARCH=amd64 go build -o ../httpcat-win64 +GOOS=windows GOARCH=amd64 go build -o ../httpcat-win64.exe ``` Intel Mac @@ -231,7 +240,7 @@ ## License -Zero-Clause BSD License +Zero-Clause BSD License: https://opensource.org/license/0bsd/ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.