testx

package
v0.0.147 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(s *http.Server, url string, opts ...requestOption) *httptest.ResponseRecorder

func DeleteJson

func DeleteJson[T any](s *http.Server, url string, opts ...requestOption) (*httptest.ResponseRecorder, T)

func GenerateMultipartBody added in v0.0.126

func GenerateMultipartBody(formData FormData) (io.Reader, *multipart.Writer)

func GetJson

func GetJson[T any](s *http.Server, url string, opts ...requestOption) (*httptest.ResponseRecorder, T)

func MultipartRequest added in v0.0.126

func MultipartRequest[T any](s *http.Server, method, url string, formData FormData, opts ...requestOption) (*httptest.ResponseRecorder, T)

func PatchJson

func PatchJson[T any](s *http.Server, url string, jsonStr string, opts ...requestOption) (*httptest.ResponseRecorder, T)

func PostJson

func PostJson[T any](s *http.Server, url string, jsonStr string, opts ...requestOption) (*httptest.ResponseRecorder, T)

func PostMultipart added in v0.0.126

func PostMultipart[T any](s *http.Server, url string, formData FormData, opts ...requestOption) (*httptest.ResponseRecorder, T)

func PutJson

func PutJson[T any](s *http.Server, url string, jsonStr string, opts ...requestOption) (*httptest.ResponseRecorder, T)

func PutMultipart added in v0.0.126

func PutMultipart[T any](s *http.Server, url string, formData FormData, opts ...requestOption) (*httptest.ResponseRecorder, T)

func WithContext added in v0.0.117

func WithContext(ctx context.Context) requestOption

func WithHeader added in v0.0.61

func WithHeader(key, value string) requestOption

Types

type ConcurrentBuffer added in v0.0.73

type ConcurrentBuffer struct {
	// contains filtered or unexported fields
}

func NewConcurrentBuffer added in v0.0.73

func NewConcurrentBuffer(t *testing.T) *ConcurrentBuffer

func (*ConcurrentBuffer) String added in v0.0.73

func (c *ConcurrentBuffer) String() string

func (*ConcurrentBuffer) Write added in v0.0.73

func (c *ConcurrentBuffer) Write(p []byte) (n int, err error)

type FileToUpload added in v0.0.126

type FileToUpload struct {
	FieldName string
	FileName  string
	Content   []byte
}

FileToUpload represents a file that will be part of the multipart form data.

type FormData added in v0.0.126

type FormData struct {
	Fields map[string]string
	Files  []FileToUpload
}

FormData represents the data for a multipart/form-data request.

Jump to

Keyboard shortcuts

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