kitsune

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: BSD-2-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authorization

func Authorization(w http.ResponseWriter, r *http.Request) (token string, ok bool)

func BadRequest

func BadRequest(w http.ResponseWriter, rej any)

func Download

func Download(endpoint string, req any) (r io.ReadCloser, err error)

func Forbidden

func Forbidden(w http.ResponseWriter, rej any)

func InternalServerError

func InternalServerError(w http.ResponseWriter, rej any)

func ParseRequest

func ParseRequest(w http.ResponseWriter, r *http.Request, req any) (ok bool)

func ParseResponse

func ParseResponse(r *http.Response, resp any) (err error)

func Reject

func Reject(w http.ResponseWriter, rej any, code int)

func Respond

func Respond(w http.ResponseWriter, resp any)

func RoundTrip

func RoundTrip(endpoint string, req any, resp any) (err error)

func SetLogFile added in v0.7.0

func SetLogFile(w io.Writer)

func Teapot

func Teapot(w http.ResponseWriter, rej any)

func TeapotHandler

func TeapotHandler(rej any) http.Handler

func Unauthorized

func Unauthorized(w http.ResponseWriter, rej any)

func Upload

func Upload(endpoint string, r io.ReadCloser, resp any) (err error)

Types

type Client added in v0.0.2

type Client struct {
	Endpoint string
	Header   http.Header
}

func (Client) Download added in v0.0.2

func (c Client) Download(ctx context.Context, req any) (body io.ReadCloser, err error)

func (Client) RoundTrip added in v0.0.2

func (c Client) RoundTrip(ctx context.Context, req any, resp any) (err error)

func (Client) Upload added in v0.0.2

func (c Client) Upload(ctx context.Context, body io.Reader, resp any) (err error)

type ResponseError

type ResponseError struct {
	StatusCode int
	Message    json.RawMessage
}

func (*ResponseError) Error

func (re *ResponseError) Error() string

Jump to

Keyboard shortcuts

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