outcome

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CanNotDownloadDirectoryError = FileNotFoundError
View Source
var FileNotFoundError = errors.New("file not found").Status(net.StatusNotFound)

Functions

func Content

func Content(content interface{}) inter.Response

func Download

func Download(filename string) inter.Response

func DownloadE

func DownloadE(filename string) (inter.Response, error)

func Html

func Html(content interface{}) inter.Response

func Json

func Json(content interface{}) inter.Response

func Redirect

func Redirect(destination string, status int) inter.Response

func RedirectPermanent

func RedirectPermanent(destination string) inter.Response

Create a permanent redirect from one URI to another.

func RedirectTemporary

func RedirectTemporary(destination string) inter.Response

Create a temporary redirect from one URI to another.

func RedirectToRoute

func RedirectToRoute(app inter.App, route string, parameters ...Parameters) inter.Response

Redirect to route by route name

func RouteByName

func RouteByName(routes inter.RouteCollection, name string) (inter.Route, error)

Receive inter.Route by name

func UrlByName

func UrlByName(app inter.App, name string, parameters ...Parameters) string

Receive the URL to a named route by app, name, uri parameters, query parameters

Types

type ContentResponse

type ContentResponse struct {
	*Response
}

type HtmlResponse

type HtmlResponse struct {
	*Response
}

type JsonResponse

type JsonResponse struct {
	*Response
}

type Options

type Options struct {
	App      inter.App
	Content  interface{}
	Headers  http.Header
	Status   int
	Encoders string
}

type Parameters

type Parameters map[string]interface{}

type Response

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

func NewResponse

func NewResponse(options Options) *Response

func (Response) App

func (r Response) App() inter.App

func (*Response) Body

func (r *Response) Body(body string) inter.Response

func (*Response) Content

func (r *Response) Content(content interface{})

Put the raw content. "response_decorators" are responsible for converting the content into a body

func (*Response) Cookie

func (r *Response) Cookie(cookies ...http.Cookie) inter.Response

func (*Response) Filename

func (r *Response) Filename(filename string) inter.Response

func (Response) GetBody

func (r Response) GetBody() string

func (Response) GetBodyE

func (r Response) GetBodyE() (string, error)

func (*Response) GetContent

func (r *Response) GetContent() interface{}

Receive the raw content. Only available before it has been converted to a body (by "response_decorators")

func (Response) GetCookies

func (r Response) GetCookies() []http.Cookie

func (Response) GetHeader

func (r Response) GetHeader(key string) string

func (Response) GetHeaders

func (r Response) GetHeaders() http.Header

func (Response) GetStatus

func (r Response) GetStatus() int

func (*Response) Header

func (r *Response) Header(key string, values ...string) inter.Response

func (*Response) Headers

func (r *Response) Headers(headers http.Header) inter.Response

func (*Response) SetApp

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

func (*Response) ShowInBrowser

func (r *Response) ShowInBrowser() inter.Response

func (*Response) Status

func (r *Response) Status(status int) inter.Response

Jump to

Keyboard shortcuts

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