优化response + wrapper
This commit is contained in:
@ -73,3 +73,11 @@ func (wh *wrapperHandle) GetContentType(ctx *gin.Context, defaultVal string) str
|
||||
contentType := strings.ToLower(ctx.ContentType())
|
||||
return wrapper.TernaryOperator.String(len(contentType) > 0, wrapper.String(contentType), wrapper.String(defaultVal)).Value()
|
||||
}
|
||||
|
||||
func (wh *wrapperHandle) GetResponseBody(ctx *gin.Context, defaultVal string) string {
|
||||
if nil == ctx {
|
||||
return defaultVal
|
||||
}
|
||||
contentType := strings.ToLower(ctx.ContentType())
|
||||
return wrapper.TernaryOperator.String(len(contentType) > 0, wrapper.String(contentType), wrapper.String(defaultVal)).Value()
|
||||
}
|
||||
|
Reference in New Issue
Block a user