response

package module
v0.0.0-...-da3cc26 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Responser

type Responser interface {
	// SetStatusCode sets the response http status code
	SetStatusCode(statusCode int)
	// StatusCode gets the response http status code
	StatusCode() int
	// SetContent sets the response body content
	SetContent(content any)
	// Content gets the response body content
	Content() any
	// SetHeader sets the response header, if replace is true, it will replace the existing header,
	// and if replace is false, it appends the new value into existing header
	SetHeader(key, header string, replace ...bool)
	// SetHeaders sets headers map to the response
	SetHeaders(headers map[string]string)
	// HasHeader returns if the specific key is exist
	HasHeader(key string) bool
	// Header returns header value of specific header
	Header(key string) string
	// Headers returns all headers as [http.Header]
	Headers() http.Header
	// SetCookie sets cookie to response
	SetCookie(cookie *http.Cookie)
	// Cookies returns all response cookies
	Cookies() []*http.Cookie
	// ServeHTTP sends the response
	ServeHTTP(w http.ResponseWriter, r *http.Request)
}

Responser the response interface

Jump to

Keyboard shortcuts

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