response

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BytesResponse

type BytesResponse struct {
	Body *bytes.Buffer
	// contains filtered or unexported fields
}

func NewBytesResponse

func NewBytesResponse() *BytesResponse

func (*BytesResponse) ClearBody

func (r *BytesResponse) ClearBody()

func (*BytesResponse) GetBodyBytes

func (r *BytesResponse) GetBodyBytes() *bytes.Buffer

func (*BytesResponse) GetHeaders

func (r *BytesResponse) GetHeaders() http.Header

func (*BytesResponse) GetHttpStatus

func (r *BytesResponse) GetHttpStatus() int

func (*BytesResponse) HeaderSet

func (r *BytesResponse) HeaderSet(key, value string)

func (*BytesResponse) SetHttpStatus

func (r *BytesResponse) SetHttpStatus(status int)

type BytesResponseWriter

type BytesResponseWriter struct {
	*BytesResponse
}

func NewBytesResponseWriter

func NewBytesResponseWriter() *BytesResponseWriter

func (BytesResponseWriter) GetHeaders

func (r BytesResponseWriter) GetHeaders() http.Header

func (BytesResponseWriter) GetHttpStatus

func (r BytesResponseWriter) GetHttpStatus() int

func (*BytesResponseWriter) Header

func (r *BytesResponseWriter) Header() http.Header

func (BytesResponseWriter) HeaderSet

func (r BytesResponseWriter) HeaderSet(key, value string)

func (BytesResponseWriter) SetHttpStatus

func (r BytesResponseWriter) SetHttpStatus(status int)

func (*BytesResponseWriter) Write

func (r *BytesResponseWriter) Write(content []byte) (int, error)

func (*BytesResponseWriter) WriteHeader

func (r *BytesResponseWriter) WriteHeader(statusCode int)

type JsonResponse

type JsonResponse struct {
	Body interface{}
	// contains filtered or unexported fields
}

func NewJsonApiResponse

func NewJsonApiResponse() *JsonResponse

func NewJsonResponse

func NewJsonResponse() *JsonResponse

func (*JsonResponse) GetBodyBytes

func (r *JsonResponse) GetBodyBytes() *bytes.Buffer

func (*JsonResponse) GetHeaders

func (r *JsonResponse) GetHeaders() http.Header

func (*JsonResponse) GetHttpStatus

func (r *JsonResponse) GetHttpStatus() int

func (*JsonResponse) HeaderSet

func (r *JsonResponse) HeaderSet(key, value string)

func (*JsonResponse) SetHttpStatus

func (r *JsonResponse) SetHttpStatus(status int)

type RedirectResponse

type RedirectResponse struct {
	*BytesResponseWriter
}

func NewRedirectResponse

func NewRedirectResponse(request *http.Request, url string, httpStatus int) *RedirectResponse

func (RedirectResponse) GetHeaders

func (r RedirectResponse) GetHeaders() http.Header

func (RedirectResponse) GetHttpStatus

func (r RedirectResponse) GetHttpStatus() int

func (RedirectResponse) HeaderSet

func (r RedirectResponse) HeaderSet(key, value string)

func (RedirectResponse) SetHttpStatus

func (r RedirectResponse) SetHttpStatus(status int)

type Response

type Response interface {
	GetHttpStatus() int
	GetHeaders() http.Header
	GetBodyBytes() *bytes.Buffer
}

type ViewResponse

type ViewResponse struct {
	*template.Template
	// contains filtered or unexported fields
}

func NewViewResponse

func NewViewResponse(templateName string) *ViewResponse

func (*ViewResponse) GetBodyBytes

func (r *ViewResponse) GetBodyBytes() *bytes.Buffer

func (*ViewResponse) GetHeaders

func (r *ViewResponse) GetHeaders() http.Header

func (*ViewResponse) GetHttpStatus

func (r *ViewResponse) GetHttpStatus() int

func (*ViewResponse) HeaderSet

func (r *ViewResponse) HeaderSet(key, value string)

func (*ViewResponse) SetData

func (r *ViewResponse) SetData(data interface{})

func (*ViewResponse) SetHttpStatus

func (r *ViewResponse) SetHttpStatus(status int)

func (*ViewResponse) SetTemplate

func (r *ViewResponse) SetTemplate(tpl *template.Template)

type WebSocketController

type WebSocketController func(*websocket.Conn)

type WebsocketUpgradeResponse

type WebsocketUpgradeResponse struct {
	*BytesResponseWriter
	// contains filtered or unexported fields
}

func NewWebsocketUpgradeResponse

func NewWebsocketUpgradeResponse(upgrader *websocket.Upgrader, controller WebSocketController) *WebsocketUpgradeResponse

func (WebsocketUpgradeResponse) GetHeaders

func (r WebsocketUpgradeResponse) GetHeaders() http.Header

func (WebsocketUpgradeResponse) GetHttpStatus

func (r WebsocketUpgradeResponse) GetHttpStatus() int

func (WebsocketUpgradeResponse) HeaderSet

func (r WebsocketUpgradeResponse) HeaderSet(key, value string)

func (WebsocketUpgradeResponse) SetHttpStatus

func (r WebsocketUpgradeResponse) SetHttpStatus(status int)

func (*WebsocketUpgradeResponse) UpgradeToWebsocket

func (r *WebsocketUpgradeResponse) UpgradeToWebsocket(request *http.Request, responseWriter http.ResponseWriter)

Jump to

Keyboard shortcuts

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