[feat] 优化 support/response, 并新增 NewHttpStatusResponse
This commit is contained in:
parent
58511825d3
commit
dae5b130bb
@ -35,13 +35,18 @@ var wsUpgrader = websocket.Upgrader{
|
||||
}
|
||||
|
||||
func (this HttpStatusResponse) Get(path ...string) req.GlobalParams {
|
||||
if this.body == nil {
|
||||
return req.NewGlobalParam("", nil)
|
||||
}
|
||||
return this.body.Get(path...)
|
||||
}
|
||||
|
||||
func (this HttpStatusResponse) Send(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(this.status)
|
||||
if this.body != nil {
|
||||
this.body.Send(w, r)
|
||||
}
|
||||
}
|
||||
|
||||
func (this RawResponse) Get(path ...string) req.GlobalParams {
|
||||
return lo.Ternary(len(path) == 0, req.NewGlobalParam(string(this.raw), nil), req.NewGlobalParam(string(this.raw), nil).Get(strings.Join(path, ".")))
|
||||
|
Loading…
Reference in New Issue
Block a user