Skip to content

Commit

Permalink
feat: add server-sent events client #658 (#931)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevatkm authored Dec 29, 2024
1 parent 8422694 commit af72a4d
Show file tree
Hide file tree
Showing 5 changed files with 1,058 additions and 2 deletions.
1 change: 1 addition & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ var (
ErrUnsupportedRequestBodyKind = errors.New("resty: unsupported request body kind")

hdrUserAgentKey = http.CanonicalHeaderKey("User-Agent")
hdrAcceptKey = http.CanonicalHeaderKey("Accept")
hdrAcceptEncodingKey = http.CanonicalHeaderKey("Accept-Encoding")
hdrContentTypeKey = http.CanonicalHeaderKey("Content-Type")
hdrContentLengthKey = http.CanonicalHeaderKey("Content-Length")
Expand Down
1 change: 0 additions & 1 deletion resty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (

var (
hdrLocationKey = http.CanonicalHeaderKey("Location")
hdrAcceptKey = http.CanonicalHeaderKey("Accept")
)

//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Expand Down
5 changes: 4 additions & 1 deletion retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ func (b *backoffWithJitter) NextWaitDuration(c *Client, res *Response, err error
b.max = maxInt
}

retryStrategyFunc := c.RetryStrategy()
var retryStrategyFunc RetryStrategyFunc
if c != nil {
retryStrategyFunc = c.RetryStrategy()
}
if res == nil || retryStrategyFunc == nil {
return b.balanceMinMax(b.defaultStrategy(attempt)), nil
}
Expand Down
Loading

0 comments on commit af72a4d

Please sign in to comment.