Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorHandler ¶
ErrorHandler should produce a response from an error.
type Headers ¶
Headers type represents an http request's headers.
func (*Headers) AddRaw ¶
AddRaw parses the input string to extract and add name/value combinations. The format of the string should be "{name}:{value}". Everything before the first colon is the name and everything after is the value.
type Request ¶
type Request struct { Version string Method string Hostname string Port string Path string Query string Headers *Headers Body io.Reader // contains filtered or unexported fields }
Request represents an HTTP request to be sent.
func ReadRequest ¶
ReadRequest parses and reads a request from r.
type Response ¶
type Response struct { Version string Status string StatusCode int Headers *Headers Body io.Reader // contains filtered or unexported fields }
Response represents a received HTTP response.
func NewResponse ¶
NewResponse creates a response for the given status and message. If no strings are given to fill the body, the status message is used. Body strings are joined with newlines.
func ReadResponse ¶
ReadResponse parses and reads a response from r.
type Server ¶
type Server struct { // Errors that cannot be handled by errHandler are sent to this channel. ErrChan chan error // contains filtered or unexported fields }
Server is used to respond to http requests.
func (*Server) Catch ¶
func (s *Server) Catch(h ErrorHandler)
Catch configures the server to use the given ErrorHandler.