package
2.0.0-rc2+incompatible
Repository: https://github.com/buger/goreplay.git
Documentation: pkg.go.dev
# Functions
AddHeader takes http payload and appends new header to the start of headers section Returns modified request payload.
Body returns request/response body.
CheckChunked checks HTTP/1 chunked data integrity(https://tools.ietf.org/html/rfc7230#section-4.1) and returns the length of total valid scanned chunks(including chunk size, extensions and CRLFs) and full is true if all chunks was scanned.
DeleteHeader takes http payload and removes header name from headers section Returns modified request payload.
GetHeaders returns mime headers from the payload.
HasFullPayload checks if this message has full or valid payloads and returns true.
HasRequestTitle reports whether this payload has an HTTP/1 request title.
HasResponseTitle reports whether this payload has an HTTP/1 response title.
HasTitle reports if this payload has an http/1 title.
Header returns header value, if header not found, value will be blank.
Method returns HTTP method.
MIMEHeadersEndPos finds end of the Headers section, which should end with empty line.
MIMEHeadersStartPos finds start of Headers section It just finds position of second line (first contains location and method).
ParseHeaders Parsing headers from the payload.
Path takes payload and returns request path: Split(firstLine, ' ')[1].
PathParam returns URL query attribute by given name, if no found: valueStart will be -1.
SetHeader sets header value.
SetHost updates Host header for HTTP/1.1 or updates host in path for HTTP/1.0 or Proxy requests Returns modified payload.
SetPath takes payload, sets new path and returns modified payload.
SetPathParam takes payload and updates path Query attribute If query param not found, it will append new Returns modified payload.
Status returns response status.
# Constants
MinRequestCount GET / HTTP/1.1\r\n.
MinResponseCount HTTP/1.1 200\r\n.
VersionLen HTTP/1.1.
# Variables
CRLF In HTTP newline defined by 2 bytes (for both windows and *nix support).
EmptyLine acts as separator: end of Headers or Body (in some cases).
HeaderDelim Separator for Header line.
Methods holds the http methods ordered in ascending order.
# Interfaces
ProtocolStateSetter is an interface used to provide protocol state for future use.