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 {
|
||||
Write(g *gin.Context)
|
||||
WithHeader(k string, v string) HTTPResponse
|
||||
IsSuccess() bool
|
||||
}
|
||||
|
||||
type jsonHTTPResponse struct {
|
||||
@ -39,6 +40,10 @@ func (j jsonHTTPResponse) WithHeader(k string, v string) HTTPResponse {
|
||||
return j
|
||||
}
|
||||
|
||||
func (j jsonHTTPResponse) IsSuccess() bool {
|
||||
return j.statusCode >= 200 && j.statusCode <= 399
|
||||
}
|
||||
|
||||
type emptyHTTPResponse struct {
|
||||
statusCode int
|
||||
headers []headerval
|
||||
@ -56,6 +61,10 @@ func (j emptyHTTPResponse) WithHeader(k string, v string) HTTPResponse {
|
||||
return j
|
||||
}
|
||||
|
||||
func (j emptyHTTPResponse) IsSuccess() bool {
|
||||
return j.statusCode >= 200 && j.statusCode <= 399
|
||||
}
|
||||
|
||||
type textHTTPResponse struct {
|
||||
statusCode int
|
||||
data string
|
||||
@ -74,6 +83,10 @@ func (j textHTTPResponse) WithHeader(k string, v string) HTTPResponse {
|
||||
return j
|
||||
}
|
||||
|
||||
func (j textHTTPResponse) IsSuccess() bool {
|
||||
return j.statusCode >= 200 && j.statusCode <= 399
|
||||
}
|
||||
|
||||
type dataHTTPResponse struct {
|
||||
statusCode int
|
||||
data []byte
|
||||
@ -93,6 +106,10 @@ func (j dataHTTPResponse) WithHeader(k string, v string) HTTPResponse {
|
||||
return j
|
||||
}
|
||||
|
||||
func (j dataHTTPResponse) IsSuccess() bool {
|
||||
return j.statusCode >= 200 && j.statusCode <= 399
|
||||
}
|
||||
|
||||
type fileHTTPResponse struct {
|
||||
mimetype string
|
||||
filepath string
|
||||
@ -117,6 +134,10 @@ func (j fileHTTPResponse) WithHeader(k string, v string) HTTPResponse {
|
||||
return j
|
||||
}
|
||||
|
||||
func (j fileHTTPResponse) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
type downloadDataHTTPResponse struct {
|
||||
statusCode int
|
||||
mimetype string
|
||||
@ -142,6 +163,10 @@ func (j downloadDataHTTPResponse) WithHeader(k string, v string) HTTPResponse {
|
||||
return j
|
||||
}
|
||||
|
||||
func (j downloadDataHTTPResponse) IsSuccess() bool {
|
||||
return j.statusCode >= 200 && j.statusCode <= 399
|
||||
}
|
||||
|
||||
type redirectHTTPResponse struct {
|
||||
statusCode int
|
||||
url string
|
||||
@ -157,6 +182,10 @@ func (j redirectHTTPResponse) WithHeader(k string, v string) HTTPResponse {
|
||||
return j
|
||||
}
|
||||
|
||||
func (j redirectHTTPResponse) IsSuccess() bool {
|
||||
return j.statusCode >= 200 && j.statusCode <= 399
|
||||
}
|
||||
|
||||
type jsonAPIErrResponse struct {
|
||||
err *exerr.ExErr
|
||||
headers []headerval
|
||||
@ -171,6 +200,10 @@ func (j jsonAPIErrResponse) WithHeader(k string, v string) HTTPResponse {
|
||||
return j
|
||||
}
|
||||
|
||||
func (j jsonAPIErrResponse) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func Status(sc int) HTTPResponse {
|
||||
return &emptyHTTPResponse{statusCode: sc}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
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