http

package
v0.0.0-...-ba0b9ec Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2018 License: MIT Imports: 20 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cookies

type Cookies map[string]*nethttp.Cookie

func (Cookies) Set

func (c Cookies) Set(cookie *nethttp.Cookie)

type Headers

type Headers map[string][]string

func (Headers) Add

func (h Headers) Add(name string, value string)

func (Headers) Remove

func (h Headers) Remove(name string)

func (Headers) Set

func (h Headers) Set(name string, value string)

type Request

type Request struct {
	Session *Session

	URL        *url.URL
	Method     string
	Cookies    map[string]*nethttp.Cookie
	RemoteAddr string
	// contains filtered or unexported fields
}

func CreateRequest

func CreateRequest(session *Session, request *nethttp.Request) *Request

func (*Request) Body

func (r *Request) Body() io.ReadCloser

func (*Request) File

func (r *Request) File(input string) (multipart.File, *multipart.FileHeader, error)

func (*Request) Form

func (r *Request) Form() url.Values

func (*Request) Header

func (r *Request) Header() nethttp.Header

func (*Request) MultipartForm

func (r *Request) MultipartForm() *multipart.Form

func (*Request) PostForm

func (r *Request) PostForm() url.Values

func (*Request) Referer

func (r *Request) Referer() string

type Response

type Response struct {
	Gzipped bool

	IsChunked bool

	IsEventStream bool

	Status  int
	Headers Headers
	Cookies Cookies
	// contains filtered or unexported fields
}

func CreateResponse

func CreateResponse(session *Session, writer nethttp.ResponseWriter) *Response

func (*Response) Chunked

func (r *Response) Chunked() chan []byte

func (*Response) Close

func (r *Response) Close()

func (*Response) EventStream

func (r *Response) EventStream() chan []byte

func (*Response) GetWriter

func (r *Response) GetWriter() nethttp.ResponseWriter

func (*Response) Gzip

func (r *Response) Gzip()

func (*Response) Redirect

func (r *Response) Redirect(url *neturl.URL, status int)

func (*Response) Send

func (r *Response) Send()

func (*Response) SessionID

func (r *Response) SessionID() string

func (*Response) Write

func (r *Response) Write(bytes []byte) (int, error)

func (*Response) WriteText

func (r *Response) WriteText(text string)

type Session

type Session struct {
	Config      *Config.Config
	Route       *route.Route
	Request     *Request
	Response    *Response
	Stash       map[string]interface{}
	SessionID   string
	SessionData map[string]string
}

func CreateSession

func CreateSession(conf *Config.Config, request *nethttp.Request, writer nethttp.ResponseWriter) *Session

func (*Session) Redirect

func (session *Session) Redirect(url *neturl.URL)

func (*Session) Render

func (session *Session) Render(asset string)

func (*Session) RenderException

func (session *Session) RenderException(status int, err error)

func (*Session) RenderNotFound

func (session *Session) RenderNotFound()

func (*Session) RenderTemplate

func (session *Session) RenderTemplate(asset string) (string, error)

func (*Session) RenderWithLayout

func (session *Session) RenderWithLayout(asset string, layout string, key string)

Jump to

Keyboard shortcuts

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