Skip to content

Commit 5ba5233

Browse files
committed
[feat] http client support error callback
1 parent a0abd8d commit 5ba5233

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

pkg/server/http/client/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ type Request struct {
5555
Body interface{}
5656
PathParam map[string]string
5757
Headers map[string]string
58+
Error interface{}
5859
}
5960

6061
// RequestMiddleware http request middleware
@@ -99,6 +100,9 @@ func (c *Client) newRequest(method string, req *Request, reply interface{}) *res
99100
if reply != nil {
100101
request.SetResult(reply)
101102
}
103+
if req.Error != nil {
104+
request.SetError(req.Error)
105+
}
102106
if method != http.MethodGet {
103107
request.SetHeader(metadata.HeaderContentType, metadata.DefaultContentTypeJson)
104108
}

0 commit comments

Comments
 (0)