response

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPException

func HTTPException(httpCode int, detail string)

Types

type FileResponse

type FileResponse struct {
	Filename string
	Body     []byte
}

func (*FileResponse) GetBody

func (h *FileResponse) GetBody() any

func (*FileResponse) GetContentType

func (h *FileResponse) GetContentType() string

func (*FileResponse) SetContentType

func (h *FileResponse) SetContentType(contentType string)

func (*FileResponse) Write

func (h *FileResponse) Write(w http.ResponseWriter)

type HTMLResponse

type HTMLResponse struct {
	Filename string
	Html     string // Highest priority
	Data     any
}

func (*HTMLResponse) GetBody

func (h *HTMLResponse) GetBody() any

func (*HTMLResponse) GetContentType

func (h *HTMLResponse) GetContentType() string

func (*HTMLResponse) SetContentType

func (h *HTMLResponse) SetContentType(contentType string)

func (*HTMLResponse) Write

func (h *HTMLResponse) Write(w http.ResponseWriter)

type HTTPResponse

type HTTPResponse[T any] struct {
	HttpCode int
	Header   map[string]string
	Cookie   map[string]string
	Body     T
}

func (*HTTPResponse[T]) GetBody

func (h *HTTPResponse[T]) GetBody() any

func (*HTTPResponse[T]) GetContentType

func (h *HTTPResponse[T]) GetContentType() string

func (*HTTPResponse[T]) SetContentType

func (h *HTTPResponse[T]) SetContentType(contentType string)

func (*HTTPResponse[T]) Write

func (h *HTTPResponse[T]) Write(w http.ResponseWriter)

type SSEResponse

type SSEResponse struct {
	SSEWriter func(s *SSEvent)
}

func (*SSEResponse) GetBody

func (s *SSEResponse) GetBody() any

func (*SSEResponse) GetContentType

func (s *SSEResponse) GetContentType() string

func (*SSEResponse) SetContentType

func (s *SSEResponse) SetContentType(contentType string)

func (*SSEResponse) Write

func (s *SSEResponse) Write(w http.ResponseWriter)

type SSEvent

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

func (*SSEvent) Write

func (s *SSEvent) Write(data SSEventData)

type SSEventData

type SSEventData struct {
	Event string
	Data  string
	Id    string
	Retry uint
}

type TextResponse added in v0.1.0

type TextResponse struct {
	Header map[string]string
	Cookie map[string]string
	Body   []byte
}

func (*TextResponse) GetBody added in v0.1.0

func (h *TextResponse) GetBody() any

func (*TextResponse) GetContentType added in v0.1.0

func (h *TextResponse) GetContentType() string

func (*TextResponse) SetContentType added in v0.1.0

func (h *TextResponse) SetContentType(contentType string)

func (*TextResponse) Write added in v0.1.0

func (h *TextResponse) Write(w http.ResponseWriter)

Jump to

Keyboard shortcuts

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