Documentation
¶
Overview ¶
Package awstest provides shared HTTP test helpers for service handler tests. The 300+ handler test files in this repository repeat the same echo.New() + httptest.NewRequest + httptest.NewRecorder + NewContext wiring; these helpers collapse it to a single call so tests focus on inputs and assertions rather than transport plumbing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeJSON ¶
func DecodeJSON(t *testing.T, rec *httptest.ResponseRecorder, v any)
DecodeJSON unmarshals the recorder's body into v, failing the test on error.
func NewContext ¶
NewContext builds an echo context and response recorder for an httptest request with the given method, path and body (body may be nil). The returned recorder captures the handler's response.
func NewJSONContext ¶
func NewJSONContext( t *testing.T, method, path string, payload any, ) (*echo.Context, *httptest.ResponseRecorder)
NewJSONContext is like NewContext but marshals payload to JSON for the request body and sets Content-Type: application/json. A nil payload yields an empty body. It fails the test if marshalling fails.
Types ¶
This section is empty.