Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Request ¶
type Request struct { Method string // e.g, GET, POST, PUT, DELETE Path string // e.g, /index.html //Headers []struct{Key, Value string} // e.g, Host: eblog.fly.dev Headers []Header // e.g, Content-Type: text/html Body string // e.g, <html><body><h1>Hi</h1></body></html> }
func NewRequest ¶
func ParseRequest ¶
ParseRequest parses a HTTP request from the given text.
func (*Request) MarshalText ¶
func (*Request) WithHeader ¶
type Response ¶
type Response struct { StatusCode int // e.g, 200 // Headers []struct{Key, Value string} // e.g, Content-Type: text/html Headers []Header // e.g, Content-Type: text/html Body string // e.g, <html><body><h1>Hi</h1></body></html> }
func ParseResponse ¶
ParseResponse parses the given HTTP/1.1 response string into the Response. It returns an error of the Response is invalid, - not a valid integet - missing status text - invalid status code - invalid headers it doesn't properly handle multi-line headers, headers with multiple values, or html-encoding, etc.zzs
func (*Response) MarshalText ¶
func (*Response) WithHeader ¶
Click to show internal directories.
Click to hide internal directories.