httputils

package
v0.39.1 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	AllowOriginHeader  = "Access-Control-Allow-Origin"
	AllowHeadersHeader = "Access-Control-Allow-Headers"
	AllowMethodsHeader = "Access-Control-Allow-Methods"

	AllControlRequestHeader = "Access-Control-Request-Method"

	AllowCredentialsHeader = "Access-Control-Allow-Credentials"
	ExposeHeadersHeader    = "Access-Control-Expose-Headers"
	MaxAgeHeader           = "Access-Control-Max-Age"

	DatlyRequestMetricsHeader      = "Datly-Show-Metrics"
	DatlyInfoHeaderValue           = "info"
	DatlyDebugHeaderValue          = "debug"
	DatlyRequestDisableCacheHeader = "Datly-Disable-Cache"
	DatlyResponseHeaderMetrics     = "Datly-Metrics"

	DatlyServiceTimeHeader = "Datly-Service-Time"
	DatlyServiceInitHeader = "Datly-Service-init"

	//ContentTypeJSON json content type
	ContentTypeJSON = "application/json"

	CharsetUTF8 = "charset=utf-8"
	//EncodingGzip encoding gzip
	EncodingGzip = "gzip"

	ContentLength = "Content-Length"
)

Variables

This section is empty.

Functions

func Compress

func Compress(reader io.Reader) (*bytes.Buffer, error)

Compress compresses input using gzip

func WriteError

func WriteError(writer http.ResponseWriter, err error)

Types

type ClosableResponse

type ClosableResponse struct {
	http.ResponseWriter
	Closed bool
}

func NewClosableResponse

func NewClosableResponse(response http.ResponseWriter) *ClosableResponse

func (*ClosableResponse) WriteHeader

func (c *ClosableResponse) WriteHeader(statusCode int)

type Request

type Request struct {
	Url           string            `velty:"-"`
	QueryParams   url.Values        `velty:"-"`
	PathVariables map[string]string `velty:"-"`
	Headers       http.Header       `velty:"-"`
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest(cookies map[string]*http.Cookie, pathVariables map[string]string, queryParams url.Values, headers http.Header) *Request

func RequestOf

func RequestOf(r *http.Request, templateURI string) (*Request, error)

func (*Request) Cookie

func (r *Request) Cookie(name string) *http.Cookie

func (*Request) HasCookie

func (r *Request) HasCookie(name string) bool

func (*Request) HasPathVariable

func (r *Request) HasPathVariable(name string) bool

func (*Request) HasQuery

func (r *Request) HasQuery(name string) bool

func (*Request) Path

func (r *Request) Path() string

func (*Request) PathVariable

func (r *Request) PathVariable(name string) string

func (*Request) QueryParam

func (r *Request) QueryParam(name string) string

func (*Request) RelativePath

func (r *Request) RelativePath() string

type Violations

type Violations []*validator.Violation

func (Violations) MergeCustom

func (v Violations) MergeCustom(custom map[string]interface{}) validator.Violations

func (Violations) MergeErrors

func (v Violations) MergeErrors(errors []*response.Error) validator.Violations

func (Violations) MergeGoViolation

func (v Violations) MergeGoViolation(violations []*govalidator.Violation) validator.Violations

func (Violations) MergeSqlViolation

func (v Violations) MergeSqlViolation(violations []*sqlxvalidator.Violation) validator.Violations

Jump to

Keyboard shortcuts

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