request

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OPTIONS httpMethod = iota
	GET
	HEAD
	POST
	PUT
	DELETE
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IncompleteRequest

type IncompleteRequest struct {
	MissingField string
}

Request misses fields (request-line or headers)

func (IncompleteRequest) Error

func (err IncompleteRequest) Error() string

type InvalidOriginPolicy

type InvalidOriginPolicy struct {
	Host   string
	Origin string
	// contains filtered or unexported fields
}

Request has a violated origin policy

func (InvalidOriginPolicy) Error

func (err InvalidOriginPolicy) Error() string

type InvalidRequest

type InvalidRequest struct {
	Field  string
	Reason string
}

invalid request - multiple-value if only 1 expected

func (InvalidRequest) Error

func (err InvalidRequest) Error() string

type RequestLine

type RequestLine struct {
	// contains filtered or unexported fields
}

RequestLine represents the HTTP Request line defined in rfc-2616 : https://tools.ietf.org/html/rfc2616#section-5.1

func (RequestLine) GetURI

func (r RequestLine) GetURI() string

GetURI returns the actual URI

func (*RequestLine) Parse

func (r *RequestLine) Parse(b []byte) error

parseRequestLine parses the first HTTP request line

type T

type T struct {
	// contains filtered or unexported fields
}

T represents an HTTP Upgrade request

func Parse

func Parse(r io.Reader) (request *T, err error)

Parse builds an upgrade HTTP request from a reader (typically bufio.NewRead of the socket)

func (*T) BuildResponse

func (r *T) BuildResponse() *response.T

BuildResponse builds a response.T from the request

func (T) GetURI

func (r T) GetURI() string

GetURI returns the actual URI

func (T) StatusCode

func (r T) StatusCode() response.StatusCode

StatusCode returns the status current

Directories

Path Synopsis
parser

Jump to

Keyboard shortcuts

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