Documentation ¶
Index ¶
- Constants
- Variables
- func AuthHeader(req *http.Request) (authenticate.Authenticate, error)
- func BindRequestModel(req *http.Request, model any) error
- func BindResponseModel(res *http.Response, model any) ([]byte, error)
- func GetContentMIME(header http.Header) string
- func Header(req *http.Request, key string) string
- func ParseHeader[T any](req *http.Request, key string, parse func(str string) (T, error)) (T, error)
- func RequestPayload(req *http.Request) ([]byte, error)
- func ResponsePayload(res *http.Response) ([]byte, error)
- func Send(res http.ResponseWriter, _ *http.Request, code int, mime string, data []byte)
- func SendCode(res http.ResponseWriter, _ *http.Request, code int)
- func SendError(res http.ResponseWriter, req *http.Request, err error)
- func SendModel(res http.ResponseWriter, req *http.Request, code int, model any)
- type Configs
Constants ¶
View Source
const ( Platform = "HTTP" ContentTypeHeader = "Content-Type" CharsetHeader = "Accept-Charset" AcceptHeader = "Accept" AuthorizationHeader = "Authorization" RealIPHeader = "X-Real-IP" AcceptLanguageHeader = "Accept-Language" SessionIDHeader = "session-id" ContentDisposition = "Content-Disposition" )
Variables ¶
View Source
var ( DefaultCors = cors.New(cors.Options{ AllowedOrigins: []string{"*"}, AllowedMethods: []string{ http.MethodGet, http.MethodPost, http.MethodPut, http.MethodPatch, http.MethodDelete, http.MethodOptions, }, AllowedHeaders: []string{"*"}, }) )
View Source
var (
ErrInvalidToken = errors.New(codes.Unauthenticated).WithDetails("invalid Authenticate")
)
Functions ¶
func AuthHeader ¶
func AuthHeader(req *http.Request) (authenticate.Authenticate, error)
func GetContentMIME ¶
func ParseHeader ¶
Types ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.