Documentation
¶
Overview ¶
Package backendtest provides shared helpers for tests that stand up a mock Confab backend with net/http/httptest.
It exists because pkg/http compresses request bodies over 1KB with zstd (see pkg/http/client.go). A mock handler that decodes r.Body as raw JSON therefore works only while payloads stay small, and silently mis-decodes larger ones into zero-valued structs — a false green, or (when the handler echoes a line count back) a spurious re-send. Read every mock backend's body through ReadRequestBody so body size never changes test behavior.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decompress ¶
Decompress returns body decoded per contentEncoding. Use it when the test needs the raw bytes too (e.g. to assert on compressed transfer size); otherwise prefer ReadRequestBody. Returns body unchanged for any encoding other than zstd, and on a decode failure — a mock backend should not panic on a malformed body.
Types ¶
This section is empty.