https

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: MIT Imports: 8 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) NotFound

func (p *Context) NotFound()

func (*Context) PostForm

func (p *Context) PostForm() 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) 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) ServeFile

func (p *Context) ServeFile(name string)

func (*Context) SetHeader

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

set header

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

Jump to

Keyboard shortcuts

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