Documentation ¶
Index ¶
- Variables
- type Response
- func (this *Response) Abort()
- func (this *Response) AbortWithError(code int, err error) *router.Error
- func (this *Response) AbortWithStatus(code int)
- func (this *Response) AbortWithStatusJSON(code int, jsonObj any)
- func (this *Response) AsciiJSON(code int, obj any)
- func (this *Response) Data(code int, contentType string, data []byte)
- func (this *Response) DataFromReader(code int, contentLength int64, contentType string, reader io.Reader, ...)
- func (this *Response) Download(filePath string, fileName string)
- func (this *Response) File(filepath string)
- func (this *Response) FileAttachment(filepath, filename string)
- func (this *Response) FileFromFS(filepath string, fs http.FileSystem)
- func (this *Response) Forbidden()
- func (this *Response) GetContext() *router.Context
- func (this *Response) HTML(code int, name string, obj any)
- func (this *Response) IndentedJSON(code int, obj any)
- func (this *Response) JSON(code int, obj any)
- func (this *Response) JSONP(code int, obj any)
- func (this *Response) ProtoBuf(code int, obj any)
- func (this *Response) PureJSON(code int, obj any)
- func (this *Response) Redirect(code int, location string)
- func (this *Response) Render(code int, r router.Render)
- func (this *Response) ReturnJson(data any)
- func (this *Response) ReturnJsonFromString(jsonStr string)
- func (this *Response) ReturnString(contents string)
- func (this *Response) SSEvent(name string, message any)
- func (this *Response) SecureJSON(code int, obj any)
- func (this *Response) SetAccepted(formats ...string)
- func (this *Response) SetCookie(name string, value string, maxAge int, path string, domain string, secure bool, ...)
- func (this *Response) SetSameSite(samesite http.SameSite)
- func (this *Response) Status(code int)
- func (this *Response) Unauthorized()
- func (this *Response) View(template string, obj any)
- func (this *Response) WithContext(ctx *router.Context) *Response
- func (this *Response) WithHeader(key string, value string) *Response
- func (this *Response) WithHeaders(headers map[string]string) *Response
- func (this *Response) WithHttpCode(httpCode int) *Response
- func (this *Response) XML(code int, obj any)
- func (this *Response) YAML(code int, obj any)
Constants ¶
This section is empty.
Variables ¶
View Source
var Default = New()
默认
Functions ¶
This section is empty.
Types ¶
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
*
- 响应 *
- @create 2021-10-28
- @author deatil
func (*Response) AbortWithError ¶
输出错误状态
func (*Response) AbortWithStatusJSON ¶
输出 json 状态
func (*Response) DataFromReader ¶
func (this *Response) DataFromReader( code int, contentLength int64, contentType string, reader io.Reader, extraHeaders map[string]string, )
DataFromReader
func (*Response) FileAttachment ¶
下载
func (*Response) FileFromFS ¶
func (this *Response) FileFromFS(filepath string, fs http.FileSystem)
FileFromFS
func (*Response) ReturnJsonFromString ¶
将json字符窜以标准json格式返回 例如,从redis读取json、格式的字符串,返回给浏览器json格式
func (*Response) SetCookie ¶
func (this *Response) SetCookie( name string, value string, maxAge int, path string, domain string, secure bool, httpOnly bool, )
设置 cookie
func (*Response) SetSameSite ¶
SetSameSite
func (*Response) WithContext ¶
设置上下文
func (*Response) WithHeader ¶
设置 header
func (*Response) WithHeaders ¶
批量设置 header
Click to show internal directories.
Click to hide internal directories.