Created
November 12, 2025 18:54
-
-
Save alanshaw/cb7164e11cdbda8ec909332ab6a09ef8 to your computer and use it in GitHub Desktop.
Decode X-Agent-Message header
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "testing" | |
| "github.com/storacha/go-ucanto/testing/helpers/printer" | |
| "github.com/storacha/go-ucanto/transport/headercar/message" | |
| ) | |
| func TestDecode(t *testing.T) { | |
| xAgentMessage := "mH4sIAAAAAAAA..." | |
| m, err := message.DecodeHeader(xAgentMessage) | |
| if err != nil { | |
| panic(err) | |
| } | |
| fmt.Println("invocations", len(m.Invocations())) | |
| fmt.Println("receipts", len(m.Receipts())) | |
| inv, _, err := m.Invocation(m.Invocations()[0]) | |
| if err != nil { | |
| panic(err) | |
| } | |
| printer.PrintDelegation(t, inv, 0) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment