mirror of
https://github.com/eolinker/apinto
synced 2025-11-01 20:42:42 +08:00
context新增原始响应状态码及其接口,并且转发至上游时记录响应时间
This commit is contained in:
@@ -14,7 +14,8 @@ var _ http_service.IResponse = (*Response)(nil)
|
||||
type Response struct {
|
||||
*ResponseHeader
|
||||
*fasthttp.Response
|
||||
responseError error
|
||||
proxyStatusCode int
|
||||
responseError error
|
||||
}
|
||||
|
||||
func (r *Response) HeadersString() string {
|
||||
@@ -69,6 +70,19 @@ func (r *Response) SetStatus(code int, status string) {
|
||||
r.responseError = nil
|
||||
}
|
||||
|
||||
//原始的响应状态码
|
||||
func (r *Response) ProxyStatusCode() int {
|
||||
return r.proxyStatusCode
|
||||
}
|
||||
|
||||
func (r *Response) ProxyStatus() string {
|
||||
return strconv.Itoa(r.proxyStatusCode)
|
||||
}
|
||||
|
||||
func (r *Response) SetProxyStatus(code int, status string) {
|
||||
r.proxyStatusCode = code
|
||||
}
|
||||
|
||||
func (r *Response) SetBody(bytes []byte) {
|
||||
r.Response.SetBody(bytes)
|
||||
r.responseError = nil
|
||||
|
||||
Reference in New Issue
Block a user