Documentation
¶
Index ¶
- Constants
- func GetClientRedirectURL(w http.ResponseWriter) string
- type Proxy
- func (p *Proxy) AddHeadEls(els *headels.HeadEls)
- func (p *Proxy) AddHeader(key, value string)
- func (p *Proxy) ApplyToResponseWriter(w http.ResponseWriter, r *http.Request)
- func (p *Proxy) GetCookies() []*http.Cookie
- func (p *Proxy) GetHeadEls() *headels.HeadEls
- func (p *Proxy) GetHeader(key string) string
- func (p *Proxy) GetHeaders(key string) []string
- func (p *Proxy) GetLocation() string
- func (p *Proxy) GetStatus() (int, string)
- func (p *Proxy) IsError() bool
- func (p *Proxy) IsRedirect() bool
- func (p *Proxy) IsSuccess() bool
- func (p *Proxy) Redirect(r *http.Request, url string, code ...int) bool
- func (p *Proxy) SetCookie(cookie *http.Cookie)
- func (p *Proxy) SetHeader(key, value string)
- func (p *Proxy) SetStatus(status int, errorStatusText ...string)
- type Response
- func (res *Response) AddHeader(key, value string)
- func (res *Response) BadRequest(reasons ...string)
- func (res *Response) ClientRedirect(url string) error
- func (res *Response) Error(status int, reasons ...string)
- func (res *Response) Forbidden(reasons ...string)
- func (res *Response) HTML(html string)
- func (res *Response) HTMLBytes(bytes []byte)
- func (res *Response) InternalServerError(reasons ...string)
- func (res *Response) IsCommitted() bool
- func (res *Response) JSON(v any)
- func (res *Response) JSONBytes(bytes []byte)
- func (res *Response) MethodNotAllowed(reasons ...string)
- func (res *Response) NotFound()
- func (res *Response) NotModified()
- func (res *Response) OK()
- func (res *Response) OKText()
- func (res *Response) Redirect(r *http.Request, url string, code ...int) (usedClientRedirect bool, err error)
- func (res *Response) ServerRedirect(r *http.Request, url string, code ...int)
- func (res *Response) SetHeader(key, value string)
- func (res *Response) SetStatus(status int)
- func (res *Response) Text(text string)
- func (res *Response) TooManyRequests(reasons ...string)
- func (res *Response) Unauthorized(reasons ...string)
Constants ¶
View Source
const ( ClientRedirectHeader = "X-Client-Redirect" ClientAcceptsRedirectHeader = "X-Accepts-Client-Redirect" )
Variables ¶
This section is empty.
Functions ¶
func GetClientRedirectURL ¶
func GetClientRedirectURL(w http.ResponseWriter) string
Types ¶
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Do not instantiate directly. Use NewProxy().
func MergeProxyResponses ¶
Consumers should deduplicate head els after calling MergeProxyResponses by using headels.ToHeadEls(proxy.GetHeadElements())
func (*Proxy) AddHeadEls ¶ added in v0.83.0
func (*Proxy) ApplyToResponseWriter ¶
func (p *Proxy) ApplyToResponseWriter(w http.ResponseWriter, r *http.Request)
func (*Proxy) GetCookies ¶
func (*Proxy) GetHeadEls ¶ added in v0.83.0
func (*Proxy) GetHeaders ¶
func (*Proxy) GetLocation ¶
func (*Proxy) IsRedirect ¶
type Response ¶
type Response struct {
Writer http.ResponseWriter
// contains filtered or unexported fields
}
func New ¶
func New(w http.ResponseWriter) Response
func (*Response) BadRequest ¶
func (*Response) ClientRedirect ¶
sets status to 200 if not already set
func (*Response) InternalServerError ¶
func (*Response) IsCommitted ¶
func (*Response) MethodNotAllowed ¶
func (*Response) NotModified ¶
func (res *Response) NotModified()
func (*Response) ServerRedirect ¶
func (*Response) TooManyRequests ¶
func (*Response) Unauthorized ¶
Click to show internal directories.
Click to hide internal directories.