package proxyutil
import "github.com/google/martian/v3/proxyutil"
Package proxyutil provides functionality for building proxies.
Index ¶
- func GetRangeStart(res *http.Response) int64
- func NewResponse(code int, body io.Reader, req *http.Request) *http.Response
- func Warning(header http.Header, err error)
- type Header
- func RequestHeader(req *http.Request) *Header
- func ResponseHeader(res *http.Response) *Header
- func (h *Header) Add(name, value string) error
- func (h *Header) All(name string) ([]string, bool)
- func (h *Header) Del(name string)
- func (h *Header) Get(name string) string
- func (h *Header) Map() http.Header
- func (h *Header) Set(name, value string) error
Functions ¶
func GetRangeStart ¶
GetRangeStart returns the byte index of the start of the range, if it has one. Returns 0 if the range header is absent, and -1 if the range header is invalid or has multi-part ranges.
func NewResponse ¶
NewResponse builds new HTTP responses. If body is nil, an empty byte.Buffer will be provided to be consistent with the guarantees provided by http.Transport and http.Client.
func Warning ¶
Warning adds an error to the Warning header in the format: 199 "martian" "error message" "date".
Types ¶
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
Header is a generic representation of a set of HTTP headers for requests and responses.
func RequestHeader ¶
RequestHeader returns a new set of headers from a request.
func ResponseHeader ¶
ResponseHeader returns a new set of headers from a request.
func (*Header) Add ¶
Add appends the value to the existing header at name for the request or response.
func (*Header) All ¶
All returns all the values for header name. If the header does not exist it returns nil, false.
func (*Header) Del ¶
Del deletes the header at name for the request or response.
func (*Header) Get ¶
Get returns the first value at header name for the request or response.
func (*Header) Map ¶
Map returns an http.Header that includes Host, Content-Length, and Transfer-Encoding.
func (*Header) Set ¶
Set sets value at header name for the request or response.
Source Files ¶
- Version
- v3.3.3 (latest)
- Published
- Aug 16, 2022
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 5 hours ago –
Tools for package owners.