request

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Res

func Res(t *testing.T, conn *fasthttp.RequestCtx) response

func Response

func Response(t *testing.T, res http.Response) response

Most cases should generates a response from a Req, but some cases will want to test an http.Response directly

Types

type Env added in v0.0.6

type Env interface {
	Request(route string) log.Logger
	ServerError(err error, conn *fasthttp.RequestCtx) http.Response
}

type Handler

type Handler func(*fasthttp.RequestCtx)

type RequestBuilder

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

func Req

func Req(t *testing.T) RequestBuilder

func (RequestBuilder) Body

func (r RequestBuilder) Body(body any) RequestBuilder

func (RequestBuilder) Conn

func (RequestBuilder) Delete

func (r RequestBuilder) Delete(handler Handler) response

func (RequestBuilder) Get

func (r RequestBuilder) Get(handler Handler) response

func (RequestBuilder) Header

func (r RequestBuilder) Header(key string, value string) RequestBuilder

func (RequestBuilder) Host

func (r RequestBuilder) Host(host string) RequestBuilder

func (RequestBuilder) Method

func (r RequestBuilder) Method(method string) RequestBuilder

func (RequestBuilder) Path

func (r RequestBuilder) Path(path string) RequestBuilder

func (RequestBuilder) Post

func (r RequestBuilder) Post(handler Handler) response

func (RequestBuilder) ProjectId

func (r RequestBuilder) ProjectId(id string) RequestBuilder

func (RequestBuilder) Put

func (r RequestBuilder) Put(handler Handler) response

func (RequestBuilder) Query

func (r RequestBuilder) Query(query ...string) RequestBuilder

func (RequestBuilder) QueryMap added in v0.0.6

func (r RequestBuilder) QueryMap(query map[string]string) RequestBuilder

func (RequestBuilder) Request

func (r RequestBuilder) Request(handler Handler) response

func (RequestBuilder) User added in v0.0.7

func (r RequestBuilder) User(id string, role ...string) RequestBuilder

func (RequestBuilder) UserValue added in v0.0.5

func (r RequestBuilder) UserValue(key string, value any) RequestBuilder

type RequestBuilderT

type RequestBuilderT[T Env] struct {
	// contains filtered or unexported fields
}

func ReqT

func ReqT[T Env](t *testing.T, env T) RequestBuilderT[T]

func (RequestBuilderT[T]) Body

func (r RequestBuilderT[T]) Body(body any) RequestBuilderT[T]

func (RequestBuilderT[T]) Delete

func (r RequestBuilderT[T]) Delete(handler func(*fasthttp.RequestCtx, T) (http.Response, error)) response

func (RequestBuilderT[T]) Get

func (r RequestBuilderT[T]) Get(handler func(*fasthttp.RequestCtx, T) (http.Response, error)) response

func (RequestBuilderT[T]) Header

func (r RequestBuilderT[T]) Header(key string, value string) RequestBuilderT[T]

func (RequestBuilderT[T]) Host

func (r RequestBuilderT[T]) Host(host string) RequestBuilderT[T]

func (RequestBuilderT[T]) Method

func (r RequestBuilderT[T]) Method(method string) RequestBuilderT[T]

func (RequestBuilderT[T]) Path

func (r RequestBuilderT[T]) Path(path string) RequestBuilderT[T]

func (RequestBuilderT[T]) Post

func (r RequestBuilderT[T]) Post(handler func(*fasthttp.RequestCtx, T) (http.Response, error)) response

func (RequestBuilderT[T]) ProjectId

func (r RequestBuilderT[T]) ProjectId(id string) RequestBuilderT[T]

func (RequestBuilderT[T]) Put

func (r RequestBuilderT[T]) Put(handler func(*fasthttp.RequestCtx, T) (http.Response, error)) response

func (RequestBuilderT[T]) Query

func (r RequestBuilderT[T]) Query(query ...string) RequestBuilderT[T]

func (RequestBuilderT[T]) QueryMap added in v0.0.6

func (r RequestBuilderT[T]) QueryMap(query map[string]string) RequestBuilderT[T]

func (RequestBuilderT[T]) Request

func (r RequestBuilderT[T]) Request(handler func(*fasthttp.RequestCtx, T) (http.Response, error)) response

func (RequestBuilderT[T]) User added in v0.0.7

func (r RequestBuilderT[T]) User(id string, role ...string) RequestBuilderT[T]

func (RequestBuilderT[T]) UserValue added in v0.0.5

func (r RequestBuilderT[T]) UserValue(key string, value any) RequestBuilderT[T]

Jump to

Keyboard shortcuts

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