Documentation
¶
Overview ¶
Package drivertest provides shared HTTP mock-server helpers for driver unit tests. It is intentionally stdlib-only so opt-in driver modules can import it without adding dependencies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CapturedRequest ¶
type CapturedRequest struct {
Method string
Path string
Query string
Header http.Header
Body []byte
}
CapturedRequest holds the details of the last request the mock server saw.
func (*CapturedRequest) DecodeJSON ¶
func (c *CapturedRequest) DecodeJSON(t *testing.T, v any)
DecodeJSON unmarshals the captured body into v, failing the test on error.
type Server ¶
type Server struct {
*httptest.Server
Captured *CapturedRequest
}
Server wraps an httptest.Server that records the request it received and replies with a fixed status code and body.
Click to show internal directories.
Click to hide internal directories.