MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestDecodeCursorMalformed

Function TestDecodeCursorMalformed

internal/httpapi/pagination_test.go:49–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

47}
48
49func TestDecodeCursorMalformed(t *testing.T) {
50 var out struct{ A string }
51 // Not valid base64url and no signature segment.
52 if err := DecodeCursor([]string{testSecret}, "!!!not-base64!!!", &out); err != ErrInvalidCursor {
53 t.Fatalf("want ErrInvalidCursor, got %v", err)
54 }
55 // Valid base64url payload + valid signature, but the payload is not the
56 // dst struct shape (a bare string).
57 bad := EncodeMust(t, testSecret, "a string, not the struct")
58 if err := DecodeCursor([]string{testSecret}, bad, &out); err != ErrInvalidCursor {
59 t.Fatalf("want ErrInvalidCursor on bad json, got %v", err)
60 }
61}
62
63func TestDecodeCursorTamperedPayload(t *testing.T) {
64 type cur struct {

Callers

nothing calls this directly

Calls 2

DecodeCursorFunction · 0.85
EncodeMustFunction · 0.85

Tested by

no test coverage detected