httputil

package
v6.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelCookie

func DelCookie(w http.ResponseWriter, r *http.Request, name string)

DelCookie deletes a cookie.

func IsHTTPS

func IsHTTPS(r *http.Request) bool

IsHTTPS is a helper function that evaluates the http.Request and returns True if the Request uses HTTPS. It is able to detect, using the X-Forwarded-Proto, if the original request was HTTPS and routed through a reverse proxy with SSL termination.

func SetCookie

func SetCookie(w http.ResponseWriter, r *http.Request, name, value string)

SetCookie writes the cookie value.

func UserAgent

func UserAgent() string

UserAgent returns the User-Agent header value identifying the Crow server in outgoing requests to git forges.

func WithUserAgent

func WithUserAgent(client *http.Client) *http.Client

WithUserAgent wraps the transport of the given http.Client so that the Crow User-Agent is sent with every request. A nil client yields a new one. The same client is returned for convenient chaining.

Types

type UserAgentTransport

type UserAgentTransport struct {
	Base      http.RoundTripper
	UserAgent string
}

UserAgentTransport is an http.RoundTripper that sets the User-Agent header on outgoing requests when one is not already present.

func (*UserAgentTransport) RoundTrip

func (t *UserAgentTransport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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