thinkgo: Index | Files

package context

import ""


Package Files

cookie.go file.go request.go response.go session.go

type Cookie struct {
    Config *CookieConfig

func ParseCookieHandler Uses

func ParseCookieHandler() *Cookie

func (*Cookie) Set Uses

func (c *Cookie) Set(name interface{}, params ...interface{}) (*http.Cookie, error)

type CookieConfig Uses

type CookieConfig struct {
    Prefix string

    Path       string    // optional
    Domain     string    // optional
    Expires    time.Time // optional
    RawExpires string    // for reading cookies only

    // MaxAge=0 means no 'Max-Age' attribute specified.
    // MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'
    // MaxAge>0 means Max-Age attribute present and given in seconds
    MaxAge   int
    Secure   bool
    HttpOnly bool
    Raw      string
    Unparsed []string // Raw text of unparsed attribute-value pairs

type File Uses

type File struct {
    FileHeader *multipart.FileHeader

func (*File) Move Uses

func (f *File) Move(directory string, name ...string) (bool, error)

type Request Uses

type Request struct {
    Request *http.Request

    CookieHandler *Cookie
    // contains filtered or unexported fields

Request HTTP request

func NewRequest Uses

func NewRequest(req *http.Request) *Request

NewRequest create a new HTTP request from *http.Request

func (*Request) All Uses

func (r *Request) All(keys ...string) map[string]string

All get all of the input and query for the request.

func (*Request) AllFiles Uses

func (r *Request) AllFiles() (map[string]*File, error)

AllFiles returns all files from the request.

func (*Request) Cookie Uses

func (r *Request) Cookie(key string, value ...string) (string, error)

Cookie Retrieve a cookie from the request.

func (*Request) Except Uses

func (r *Request) Except(keys ...string) map[string]string

Except Get all of the input except for a specified array of items.

func (*Request) Exists Uses

func (r *Request) Exists(keys ...string) bool

Has Determine if the request contains a given input item key.

func (*Request) File Uses

func (r *Request) File(key string) (*File, error)

File returns a file from the request.

func (*Request) FullUrl Uses

func (r *Request) FullUrl() string

FullUrl get the full URL for the request.

func (*Request) GetContent Uses

func (r *Request) GetContent() ([]byte, error)

GetContent Returns the request body content.

func (*Request) GetHttpRequest Uses

func (r *Request) GetHttpRequest() *http.Request

GetHttpRequest get Current *http.Request

func (*Request) GetMethod Uses

func (r *Request) GetMethod() string

GetMethod get the request method.

func (*Request) GetPath Uses

func (r *Request) GetPath() string

GetPath get the request path.

func (*Request) Has Uses

func (r *Request) Has(keys ...string) bool

Filled Determine if the request contains a non-empty value for an input item.

func (*Request) Input Uses

func (r *Request) Input(key string, value ...string) (string, error)

Input returns a input item from the request.

func (*Request) IsMethod Uses

func (r *Request) IsMethod(m string) bool

IsMethod checks if the request method is of specified type.

func (*Request) Method Uses

func (r *Request) Method() string

Method get the current method for the request.

func (*Request) Only Uses

func (r *Request) Only(keys ...string) map[string]string

Only get a subset of the items from the input data.

func (*Request) Path Uses

func (r *Request) Path() string

Path get the current path info for the request.

func (*Request) Post Uses

func (r *Request) Post(key string, value ...string) (string, error)

Input returns a post item from the request.

func (*Request) Query Uses

func (r *Request) Query(key string, value ...string) (string, error)

Query returns a query string item from the request.

func (*Request) Session Uses

func (r *Request) Session() Session

Session get the session associated with the request.

func (*Request) SetSession Uses

func (r *Request) SetSession(s Session)

Session set the session associated with the request.

func (*Request) Url Uses

func (r *Request) Url() string

Url get the URL (no query string) for the request.

type Response Uses

type Response struct {
    CookieHandler *Cookie
    Header        *http.Header
    // contains filtered or unexported fields

func ErrorResponse Uses

func ErrorResponse() *Response

NotFoundResponse Create a new HTTP Error Response

func NewResponse Uses

func NewResponse() *Response

NewResponse Create a new HTTP Response

func NotFoundResponse Uses

func NotFoundResponse() *Response

NotFoundResponse Create a new HTTP NotFoundResponse

func Redirect Uses

func Redirect(to string) *Response

Redirect Create a new HTTP Redirect Response

func (*Response) Cookie Uses

func (r *Response) Cookie(name interface{}, params ...interface{}) error

Cookie Add a cookie to the response.

func (*Response) GetCharset Uses

func (r *Response) GetCharset() string

GetContentType get the Charset on the response.

func (*Response) GetCode Uses

func (r *Response) GetCode() int

GetCode get the response status code.

func (*Response) GetContent Uses

func (r *Response) GetContent() string

GetCode get the response content.

func (*Response) GetContentType Uses

func (r *Response) GetContentType() string

GetContentType get the Content-Type on the response.

func (*Response) Send Uses

func (r *Response) Send(w http.ResponseWriter)

Send Sends HTTP headers and content.

func (*Response) SetCharset Uses

func (r *Response) SetCharset(val string) *Response

GetContentType sets the Charset on the response.

func (*Response) SetCode Uses

func (r *Response) SetCode(val int) *Response

SetCode sets the status code on the response.

func (*Response) SetContent Uses

func (r *Response) SetContent(val string) *Response

SetContent sets the content on the response.

func (*Response) SetContentType Uses

func (r *Response) SetContentType(val string) *Response

GetContentType sets the Content-Type on the response.

type Session Uses

type Session interface {
    Get(name string, value ...interface{}) interface{}

    Set(name string, value interface{})

    All() map[string]interface{}

    Remove(name string) interface{}

    Forget(names ...string)



Package context imports 12 packages (graph). Updated 2020-08-03. Refresh now. Tools for package owners.