Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kon3gor committed Aug 30, 2024
1 parent d599a57 commit 73738f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 3 additions & 3 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1111,15 +1111,15 @@ func TestResponseBodyLimit(t *testing.T) {

_, err := c.R().Get(ts.URL + "/")
assertNotNil(t, err)
assertEqual(t, err, ErrResponseBodyTooLarge)
assertErrorIs(t, ErrResponseBodyTooLarge, err)
})

t.Run("request body limit", func(t *testing.T) {
c := dc()

_, err := c.R().SetResponseBodyLimit(1024).Get(ts.URL + "/")
assertNotNil(t, err)
assertEqual(t, err, ErrResponseBodyTooLarge)
assertErrorIs(t, ErrResponseBodyTooLarge, err)
})

t.Run("body less than limit", func(t *testing.T) {
Expand Down Expand Up @@ -1149,6 +1149,6 @@ func TestResponseBodyLimit(t *testing.T) {
c := dc()

_, err := c.R().SetResponseBodyLimit(10240).Get(tse.URL + "/")
assertErrorIs(t, err, gzip.ErrHeader)
assertErrorIs(t, gzip.ErrHeader, err)
})
}
8 changes: 2 additions & 6 deletions context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ package resty

import (
"context"
"errors"
"net/http"
"net/url"
"strings"
"sync/atomic"
"testing"
Expand Down Expand Up @@ -208,9 +208,5 @@ func TestRequestContext(t *testing.T) {
}

func errIsContextCanceled(err error) bool {
ue, ok := err.(*url.Error)
if !ok {
return false
}
return ue.Err == context.Canceled
return errors.Is(err, context.Canceled)
}

0 comments on commit 73738f9

Please sign in to comment.