v0.0.327
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m44s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m44s
This commit is contained in:
parent
4aa2f494b1
commit
8a3965f666
@ -15,6 +15,7 @@ type headerval struct {
|
|||||||
type HTTPResponse interface {
|
type HTTPResponse interface {
|
||||||
Write(g *gin.Context)
|
Write(g *gin.Context)
|
||||||
WithHeader(k string, v string) HTTPResponse
|
WithHeader(k string, v string) HTTPResponse
|
||||||
|
IsSuccess() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type jsonHTTPResponse struct {
|
type jsonHTTPResponse struct {
|
||||||
@ -39,6 +40,10 @@ func (j jsonHTTPResponse) WithHeader(k string, v string) HTTPResponse {
|
|||||||
return j
|
return j
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (j jsonHTTPResponse) IsSuccess() bool {
|
||||||
|
return j.statusCode >= 200 && j.statusCode <= 399
|
||||||
|
}
|
||||||
|
|
||||||
type emptyHTTPResponse struct {
|
type emptyHTTPResponse struct {
|
||||||
statusCode int
|
statusCode int
|
||||||
headers []headerval
|
headers []headerval
|
||||||
@ -56,6 +61,10 @@ func (j emptyHTTPResponse) WithHeader(k string, v string) HTTPResponse {
|
|||||||
return j
|
return j
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (j emptyHTTPResponse) IsSuccess() bool {
|
||||||
|
return j.statusCode >= 200 && j.statusCode <= 399
|
||||||
|
}
|
||||||
|
|
||||||
type textHTTPResponse struct {
|
type textHTTPResponse struct {
|
||||||
statusCode int
|
statusCode int
|
||||||
data string
|
data string
|
||||||
@ -74,6 +83,10 @@ func (j textHTTPResponse) WithHeader(k string, v string) HTTPResponse {
|
|||||||
return j
|
return j
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (j textHTTPResponse) IsSuccess() bool {
|
||||||
|
return j.statusCode >= 200 && j.statusCode <= 399
|
||||||
|
}
|
||||||
|
|
||||||
type dataHTTPResponse struct {
|
type dataHTTPResponse struct {
|
||||||
statusCode int
|
statusCode int
|
||||||
data []byte
|
data []byte
|
||||||
@ -93,6 +106,10 @@ func (j dataHTTPResponse) WithHeader(k string, v string) HTTPResponse {
|
|||||||
return j
|
return j
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (j dataHTTPResponse) IsSuccess() bool {
|
||||||
|
return j.statusCode >= 200 && j.statusCode <= 399
|
||||||
|
}
|
||||||
|
|
||||||
type fileHTTPResponse struct {
|
type fileHTTPResponse struct {
|
||||||
mimetype string
|
mimetype string
|
||||||
filepath string
|
filepath string
|
||||||
@ -117,6 +134,10 @@ func (j fileHTTPResponse) WithHeader(k string, v string) HTTPResponse {
|
|||||||
return j
|
return j
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (j fileHTTPResponse) IsSuccess() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
type downloadDataHTTPResponse struct {
|
type downloadDataHTTPResponse struct {
|
||||||
statusCode int
|
statusCode int
|
||||||
mimetype string
|
mimetype string
|
||||||
@ -142,6 +163,10 @@ func (j downloadDataHTTPResponse) WithHeader(k string, v string) HTTPResponse {
|
|||||||
return j
|
return j
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (j downloadDataHTTPResponse) IsSuccess() bool {
|
||||||
|
return j.statusCode >= 200 && j.statusCode <= 399
|
||||||
|
}
|
||||||
|
|
||||||
type redirectHTTPResponse struct {
|
type redirectHTTPResponse struct {
|
||||||
statusCode int
|
statusCode int
|
||||||
url string
|
url string
|
||||||
@ -157,6 +182,10 @@ func (j redirectHTTPResponse) WithHeader(k string, v string) HTTPResponse {
|
|||||||
return j
|
return j
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (j redirectHTTPResponse) IsSuccess() bool {
|
||||||
|
return j.statusCode >= 200 && j.statusCode <= 399
|
||||||
|
}
|
||||||
|
|
||||||
type jsonAPIErrResponse struct {
|
type jsonAPIErrResponse struct {
|
||||||
err *exerr.ExErr
|
err *exerr.ExErr
|
||||||
headers []headerval
|
headers []headerval
|
||||||
@ -171,6 +200,10 @@ func (j jsonAPIErrResponse) WithHeader(k string, v string) HTTPResponse {
|
|||||||
return j
|
return j
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (j jsonAPIErrResponse) IsSuccess() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func Status(sc int) HTTPResponse {
|
func Status(sc int) HTTPResponse {
|
||||||
return &emptyHTTPResponse{statusCode: sc}
|
return &emptyHTTPResponse{statusCode: sc}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.326"
|
const GoextVersion = "0.0.327"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2023-12-02T13:07:36+0100"
|
const GoextVersionTimestamp = "2023-12-02T13:15:19+0100"
|
||||||
|
Loading…
Reference in New Issue
Block a user