testutil

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpHandlerInOut

func HttpHandlerInOut[In, Out any](m Marshaller[Out], u Unmarshaller[In], handler func(r *http.Request, in In) (int, Out)) http.Handler

func HttpHandlerOut

func HttpHandlerOut[Out any](m Marshaller[Out], handler func(r *http.Request) (int, Out)) http.Handler

func JsonHandlerInOut

func JsonHandlerInOut[In, Out any](handler func(r *http.Request, in In) (int, Out)) http.Handler

func JsonHandlerOut

func JsonHandlerOut[Out any](handler func(r *http.Request) (int, Out)) http.Handler

func MarshallJson

func MarshallJson[Type any](value Type) ([]byte, error)

func MarshallString

func MarshallString(value string) ([]byte, error)

func NewClient

func NewClient(server *httptest.Server) *http.Client

func StringHandlerInOut

func StringHandlerInOut(handler func(r *http.Request, in string) (int, string)) http.Handler

func StringHandlerOut

func StringHandlerOut(handler func(r *http.Request) (int, string)) http.Handler

func UnmarshallJson

func UnmarshallJson[Type any](data []byte) (Type, error)

func UnmarshallString

func UnmarshallString(data []byte) (string, error)

Types

type Marshaller

type Marshaller[Type any] interface {
	Marshall(v Type) ([]byte, error)
}

type MarshallerFunc

type MarshallerFunc[Type any] func(v Type) ([]byte, error)

func (MarshallerFunc[Type]) Marshall

func (f MarshallerFunc[Type]) Marshall(v Type) ([]byte, error)

type Unmarshaller

type Unmarshaller[Type any] interface {
	Unmarshal(data []byte) (Type, error)
}

type UnmarshallerFunc

type UnmarshallerFunc[Type any] func([]byte) (Type, error)

func (UnmarshallerFunc[Type]) Unmarshal

func (f UnmarshallerFunc[Type]) Unmarshal(data []byte) (Type, error)

Jump to

Keyboard shortcuts

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