network_interception

command
v0.1.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 8 Imported by: 0

README

Go SDK Network Interception Example

This is a single, minimal example of callback-based response interception with the Go SDK.

It shows one after hook callback that:

  • runs only for host=httpbin.org and path=/response-headers
  • removes response header X-Upstream
  • adds response header X-Intercepted: callback
  • fully replaces the response body with {"msg":"from-callback"}

Run

From the repository root:

go run ./examples/go/network_interception

The example uses matchlock from PATH by default. If you want to override the binary path, set:

export MATCHLOCK_BIN=/path/to/matchlock

What To Expect

The command output should include:

  • response body {"msg":"from-callback"}
  • header X-Intercepted: callback
  • final line: OK: callback hook intercepted and mutated the response

The program exits with an error if those expectations are not met.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL