http

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: MIT Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	context.Context
	WithValue(key string, value any)
	EngineContext() any
	Header(key, defaultValue string) string
	Headers() http.Header
	Method() string
	Path() string
	Secure() bool
	Url() string
	FullUrl() string
	Ip() string

	//Input Retrieve  an input item from the request: /users/{id}
	Params(key string) string
	// Query Retrieve a query string item form the request: /users?id=1
	Query(key, defaultValue string) string
	// Form Retrieve a form string item form the post: /users POST:id=1
	Form(key, defaultValue string) string
	Bind(obj any) error
	Status(code int) Context
	AbortWithStatus(code int)
	Next() error

	Cookies(key string, defaultValue ...string) string
	Cookie(co *Cookie)

	File
	Request
	Response
}
type Cookie struct {
	Name        string    `json:"name"`
	Value       string    `json:"value"`
	Path        string    `json:"path"`
	Domain      string    `json:"domain"`
	MaxAge      int       `json:"max_age"`
	Expires     time.Time `json:"expires"`
	Secure      bool      `json:"secure"`
	HTTPOnly    bool      `json:"http_only"`
	SameSite    string    `json:"same_site"`
	SessionOnly bool      `json:"session_only"`
}

type ErrorHandler added in v1.0.3

type ErrorHandler = func(Context, error) error

type File

type File interface {
	SaveFile(name string, dst string) error
	File(name string) (*multipart.FileHeader, error)
}

type FormRequest

type FormRequest interface {
	Messages() map[string]string
	Authorize() bool
}

type HandlerFunc

type HandlerFunc func(Context) error

func (*HandlerFunc) ServeHTTP added in v1.0.5

func (h *HandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Json

type Json map[string]any

type Request

type Request interface {
	Origin() *http.Request
}

type Response

type Response interface {
	view.View
	String(format string, values ...any) error
	Json(obj any) error
	SendFile(filepath string, compress ...bool) error
	Download(filepath, filename string) error
	StatusCode() int
	SetHeader(key, value string) Context
	Vary(key string, value ...string)
}

Jump to

Keyboard shortcuts

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