http

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRequest

func NewRequest(options Options) inter.Request

Types

type Kernel

type Kernel struct {
	App        *inter.App
	Router     router.Router
	Middleware []inter.Pipe
}

func (Kernel) Handle

func (k Kernel) Handle(request inter.Request) inter.Response

Handle an incoming HTTP request.

type Options

type Options struct {
	App     inter.App
	Source  http.Request
	Method  string
	Url     string
	Headers http.Header
	Host    string
	Body    string
	Route   *mux.Route
}

type Request

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

func (Request) App

func (r Request) App() inter.App

func (Request) Content

func (r Request) Content() string

func (Request) Header

func (r Request) Header(key string) string

func (Request) Headers

func (r Request) Headers() http.Header

func (Request) Method

func (r Request) Method() string

func (Request) QueryValue

func (r Request) QueryValue(key string) inter.Value

func (Request) QueryValues

func (r Request) QueryValues(key string) []inter.Value

func (*Request) SetApp

func (r *Request) SetApp(app inter.App) inter.Request

func (*Request) SetContent

func (r *Request) SetContent(content string) inter.Request

func (*Request) SetUrlValues

func (r *Request) SetUrlValues(vars map[string]string) inter.Request

func (Request) Source

func (r Request) Source() http.Request

func (Request) UrlValue

func (r Request) UrlValue(key string) inter.Value

type Values

type Values map[string][]inter.Value

Values maps a string key to a list of values. It is typically used for query parameters and form values. Unlike in the http.Header map, the keys in a Values map are case-sensitive.

func NewUrlByMultiValues

func NewUrlByMultiValues(rawMapWithValues map[string][]string) Values

func NewUrlByValues

func NewUrlByValues(rawValues map[string]string) Values

func (Values) Add

func (v Values) Add(key string, value inter.Value)

Add adds the value to key. It appends to any existing values associated with key.

func (Values) Del

func (v Values) Del(key string)

Del deletes the values associated with key.

func (Values) Get

func (v Values) Get(key string) inter.Value

Get gets the first value associated with the given key. If there are no values associated with the key, Get returns the empty string. To access multiple values, use the map directly.

func (Values) GetMulti

func (v Values) GetMulti(key string) []inter.Value

func (Values) Set

func (v Values) Set(key string, value inter.Value)

Set sets the key to value. It replaces any existing values.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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