2023-07-18 14:40:10 +02:00
|
|
|
package ginext
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gin-gonic/gin"
|
2023-07-24 11:11:15 +02:00
|
|
|
"gogs.mikescher.com/BlackForestBytes/goext/exerr"
|
2023-07-18 14:40:10 +02:00
|
|
|
)
|
|
|
|
|
2024-01-12 15:10:48 +01:00
|
|
|
type cookieval struct {
|
|
|
|
name string
|
|
|
|
value string
|
|
|
|
maxAge int
|
|
|
|
path string
|
|
|
|
domain string
|
|
|
|
secure bool
|
|
|
|
httpOnly bool
|
|
|
|
}
|
|
|
|
|
2023-07-24 14:16:02 +02:00
|
|
|
type headerval struct {
|
|
|
|
Key string
|
|
|
|
Val string
|
|
|
|
}
|
|
|
|
|
2023-07-18 14:40:10 +02:00
|
|
|
type HTTPResponse interface {
|
|
|
|
Write(g *gin.Context)
|
2023-07-24 14:16:02 +02:00
|
|
|
WithHeader(k string, v string) HTTPResponse
|
2024-01-12 15:10:48 +01:00
|
|
|
WithCookie(name string, value string, maxAge int, path string, domain string, secure bool, httpOnly bool) HTTPResponse
|
2023-12-02 13:15:19 +01:00
|
|
|
IsSuccess() bool
|
2023-07-18 14:40:10 +02:00
|
|
|
}
|
|
|
|
|
2023-12-28 01:36:21 +01:00
|
|
|
type InspectableHTTPResponse interface {
|
|
|
|
HTTPResponse
|
|
|
|
|
|
|
|
Statuscode() int
|
|
|
|
BodyString(g *gin.Context) *string
|
|
|
|
ContentType() string
|
|
|
|
Headers() []string
|
|
|
|
}
|
|
|
|
|
2023-07-25 10:51:14 +02:00
|
|
|
func NotImplemented() HTTPResponse {
|
|
|
|
return Error(exerr.New(exerr.TypeNotImplemented, "").Build())
|
2023-07-18 14:40:10 +02:00
|
|
|
}
|