http

package
v0.0.0-...-1858810 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContentOctetStream = "application/octet-stream"

Functions

func GetProjectName

func GetProjectName(ctx Context) string

func ValidateProjectNameMiddleware

func ValidateProjectNameMiddleware(ctx Context) error

Types

type Context

type Context interface {
	AbortWithJson(code int, i any) //Не использовать. Не понятно почему, но не работает, пофиксить
	JSON(code int, i any)
	Bind(i any) error
	FormFile(name string) (*multipart.FileHeader, error)
	Body() io.ReadCloser
	NoContent(code int)
	Param(string) string
	QueryParams() url.Values
	QueryParam(name string) string
	OriginalURL() string
	Request() *http.Request
	Redirect(location string, status int) error
	Header(key string) string
	SetHeader(key string, val string)
	SetHeaders([]Header)
	OctetStream(code int, data []byte)
}

type DefaultParams

type DefaultParams struct {
	ContentLength int
	Range         bool
	StartRange    int
	EndRange      int
	Location      string
	ContentType   string
	UUID          string
	Digest        string
}

func NewRegisryHeadersParams

func NewRegisryHeadersParams() *DefaultParams

func (*DefaultParams) WithContentLength

func (p *DefaultParams) WithContentLength(length int) *DefaultParams

func (*DefaultParams) WithContentType

func (p *DefaultParams) WithContentType(content string) *DefaultParams

func (*DefaultParams) WithDigest

func (p *DefaultParams) WithDigest(digest string) *DefaultParams

func (*DefaultParams) WithLocation

func (p *DefaultParams) WithLocation(location string) *DefaultParams

func (*DefaultParams) WithRange

func (p *DefaultParams) WithRange(start, end int) *DefaultParams

func (*DefaultParams) WithUUID

func (p *DefaultParams) WithUUID(uuid string) *DefaultParams

type Handler

type Handler interface {
	Handle(ctx Context) error
}

type HandlerFunc

type HandlerFunc func(ctx Context) error

func (HandlerFunc) Handle

func (h HandlerFunc) Handle(ctx Context) error
type Header struct {
	Key   string
	Value string
}

func CreateRegistryHeaders

func CreateRegistryHeaders(params *DefaultParams) []Header

type Server

type Server interface {
	Run()
	Shutdown()
}

Jump to

Keyboard shortcuts

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