https

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: MIT Imports: 9 Imported by: 0

README

https

http server

Only supply some utils now.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	W http.ResponseWriter
	R *http.Request
}

func NewContext

func NewContext(w http.ResponseWriter, r *http.Request) *Context

func (*Context) AddHeader

func (p *Context) AddHeader(name, value string)

add header to the response.

func (*Context) DelHeader

func (p *Context) DelHeader(name string)

del response header

func (*Context) Form

func (p *Context) Form() url.Values

func (*Context) FormValue

func (p *Context) FormValue(name string) string

func (*Context) GetBody added in v0.1.3

func (p *Context) GetBody() ([]byte, error)

func (*Context) NotFound

func (p *Context) NotFound()

func (*Context) PostForm

func (p *Context) PostForm() url.Values

func (*Context) Query added in v0.1.2

func (p *Context) Query() url.Values

func (*Context) ReadForm added in v0.1.1

func (p *Context) ReadForm(data interface{}) error

ReadForm binds the formObject with the form data it supports any kind of type, including custom structs. It will return nothing if request data are empty. The struct field tag is "form".

func (*Context) ReadJSON added in v0.1.3

func (p *Context) ReadJSON(v interface{}) error

func (*Context) ReadQuery

func (p *Context) ReadQuery(data interface{}) error

ReadQuery binds the "ptr" with the url query string. The struct field tag is "url".

func (*Context) ReadXML added in v0.1.3

func (p *Context) ReadXML(v interface{}) error

func (*Context) ServeFile

func (p *Context) ServeFile(name string)

func (*Context) SetHeader

func (p *Context) SetHeader(name, value string)

set header

func (*Context) UnmarshalBody added in v0.1.3

func (p *Context) UnmarshalBody(v interface{}, unmarshaler UnmarshalerFunc) error

func (*Context) Write

func (p *Context) Write(data []byte) (n int, err error)

func (*Context) WriteHeader

func (p *Context) WriteHeader(statusCode int, h http.Header)

h may be nil

func (*Context) WriteJSON

func (p *Context) WriteJSON(v interface{}) error

func (*Context) WriteString

func (p *Context) WriteString(str string) error

func (*Context) WriteXML

func (p *Context) WriteXML(v interface{}) error

type UnmarshalerFunc added in v0.1.3

type UnmarshalerFunc func(data []byte, v interface{}) error

Jump to

Keyboard shortcuts

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