Socket
Book a DemoInstallSign in
Socket

github.com/tetratelabs/proxy-wasm-go-sdk/examples/http_body

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/tetratelabs/proxy-wasm-go-sdk/examples/http_body

Source
Go
Version
v0.0.0-20250424192219-6fd215fe1c58
Version published
Created
Source

http_body

this example demonstrates how to perform operation on a request or response body like append/prepend/replace.

To modify the request:

$ curl -XPUT localhost:18000 --data '[initial body]' -H "buffer-operation: prepend"
[this is prepended body][initial body]

$ curl -XPUT localhost:18000 --data '[initial body]' -H "buffer-operation: append"
[initial body][this is appended body]

$ curl -XPUT localhost:18000 --data '[initial body]' -H "buffer-operation: replace"
[this is replaced body]

To modify the response:

$ curl -XPUT localhost:18000 --data '[initial body]' -H "buffer-operation: prepend" -H "buffer-replace-at: response"
[this is prepended body][initial body]

$ curl -XPUT localhost:18000 --data '[initial body]' -H "buffer-operation: append" -H "buffer-replace-at: response"
[initial body][this is appended body]

$ curl -XPUT localhost:18000 --data '[initial body]' -H "buffer-operation: replace" -H "buffer-replace-at: response"
[this is replaced body]

FAQs

Package last updated on 24 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts