goext/ginext/response.go
Mike Schwörer bc5c61e43d
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m37s
v0.0.483
2024-07-16 15:08:37 +02:00

49 lines
897 B
Go

package ginext
import (
"github.com/gin-gonic/gin"
"gogs.mikescher.com/BlackForestBytes/goext/exerr"
)
type cookieval struct {
name string
value string
maxAge int
path string
domain string
secure bool
httpOnly bool
}
type headerval struct {
Key string
Val string
}
type HTTPResponse interface {
Write(g *gin.Context)
WithHeader(k string, v string) HTTPResponse
WithCookie(name string, value string, maxAge int, path string, domain string, secure bool, httpOnly bool) HTTPResponse
IsSuccess() bool
}
type InspectableHTTPResponse interface {
HTTPResponse
Statuscode() int
BodyString(g *gin.Context) *string
ContentType() string
Headers() []string
}
type InspectableHTTPErrorResponse interface {
HTTPResponse
InspectableHTTPResponse
Error() error
}
func NotImplemented() HTTPResponse {
return Error(exerr.New(exerr.TypeNotImplemented, "").Build())
}