utils

package
v0.0.0-...-c1be4bf Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseLogLevel

func ParseLogLevel(logLevel string) (slog.Level, error)

func RespondWithError

func RespondWithError(writer http.ResponseWriter, code int, message string, err error)

func RespondWithJSON

func RespondWithJSON(writer http.ResponseWriter, code int, payload interface{})

func RespondWithNoContent

func RespondWithNoContent(writer http.ResponseWriter, code int)

func RespondWithString

func RespondWithString(writer http.ResponseWriter, contentType string, code int, msg string)

func TestExpectedMessage

func TestExpectedMessage(t *testing.T, rr *httptest.ResponseRecorder, m string)

func TestExpectedStatus

func TestExpectedStatus(t *testing.T, rr *httptest.ResponseRecorder, statusCode int)

func TestRequest

func TestRequest(t *testing.T, method string, url string, body io.Reader, handler func(http.ResponseWriter, *http.Request)) *httptest.ResponseRecorder

func TestRequestWithHeaders

func TestRequestWithHeaders(t *testing.T, method string, url string, headers map[string][]string, body io.Reader, handler func(http.ResponseWriter, *http.Request)) *httptest.ResponseRecorder

Types

This section is empty.

Jump to

Keyboard shortcuts

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