httpassert

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintJSON

func PrintJSON(t *testing.T, v any)

PrintJSON is a debugging test helper that will pretty-print any JSON-marshallable value.

func ResponseEqual

func ResponseEqual(t *testing.T, actual, expected *http.Response)

ResponseEqual compares to http.Response objects for equality. Individual field comparisons are enabled by the non-nil checks. For example, if the expected `http.Response.Header` field is `nil`, no comparison with actual `http.Response.Header` takes place. JSON responses are autodetected and the response body payloads will be compared as valid JSON using `assert.JSONEq`.

func SuccessfulJSONResponseEqual

func SuccessfulJSONResponseEqual(t *testing.T, actual *http.Response, body []byte)

SuccessfulJSONResponseEqual is a shorthand for asserting the JSON body contents for a successful response.

func URLFromString

func URLFromString(t *testing.T, fullURL string) *url.URL

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL