mrresponse

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorAttributeIDByDefault = "generalError"
)

Variables

This section is empty.

Functions

func HandlerGetMethodNotAllowedAsJson added in v0.14.0

func HandlerGetMethodNotAllowedAsJson() func(w http.ResponseWriter, r *http.Request)

func HandlerGetNotFoundAsJson added in v0.14.0

func HandlerGetNotFoundAsJson() func(w http.ResponseWriter, r *http.Request)

func HandlerGetSystemInfoAsJson added in v0.14.0

func HandlerGetSystemInfoAsJson(cfg SystemInfoConfig) (func(w http.ResponseWriter, r *http.Request), error)

Types

type ErrorAttribute

type ErrorAttribute struct {
	ID        string `json:"id"`
	Value     string `json:"value"`
	DebugInfo string `json:"debugInfo,omitempty"`
}

type ErrorDetailsResponse

type ErrorDetailsResponse struct {
	Title        string `json:"title"`
	Details      string `json:"details"`
	Request      string `json:"request"`
	Time         string `json:"time"`
	ErrorTraceID string `json:"errorTraceId,omitempty"`
}

ErrorDetailsResponse - application/problem+json (401, 403, 404, 418, 5XX)

type ErrorListResponse

type ErrorListResponse []ErrorAttribute

ErrorListResponse - application/json (400)

type ErrorSender

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

func NewErrorSender

func NewErrorSender(encoder mrserver.ResponseEncoder) *ErrorSender

func NewErrorSenderWithOverrideFunc

func NewErrorSenderWithOverrideFunc(
	encoder mrserver.ResponseEncoder,
	overrideFunc mrserver.HttpErrorOverrideFunc,
) *ErrorSender

func (*ErrorSender) SendError

func (rs *ErrorSender) SendError(w http.ResponseWriter, r *http.Request, err error)

type FileSender

type FileSender struct {
	*Sender
}

func NewFileSender

func NewFileSender(base *Sender) *FileSender

func (*FileSender) SendAttachmentFile added in v0.14.0

func (rs *FileSender) SendAttachmentFile(ctx context.Context, w http.ResponseWriter, file mrtype.File) error

func (*FileSender) SendFile

func (rs *FileSender) SendFile(ctx context.Context, w http.ResponseWriter, file mrtype.File) error

type Sender

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

func NewSender

func NewSender(encoder mrserver.ResponseEncoder) *Sender

func (*Sender) Send

func (rs *Sender) Send(w http.ResponseWriter, status int, structure any) error

func (*Sender) SendBytes added in v0.14.0

func (rs *Sender) SendBytes(w http.ResponseWriter, status int, body []byte) error

func (*Sender) SendNoContent

func (rs *Sender) SendNoContent(w http.ResponseWriter) error

type SystemInfoConfig added in v0.14.0

type SystemInfoConfig struct {
	Name      string
	Version   string
	StartedAt time.Time
}

Jump to

Keyboard shortcuts

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