-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
38 changed files
with
1,277 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package errutil | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
var rtErr = errors.New("RoundTripper error") | ||
|
||
func IsMockedError(err error) bool { | ||
return errors.Is(err, rtErr) | ||
} | ||
|
||
// ErrorRoundTripper is a custom RoundTripper that always returns an error. | ||
type ErrorRoundTripper struct { | ||
Err error | ||
} | ||
|
||
func (ert *ErrorRoundTripper) RoundTrip(*http.Request) (*http.Response, error) { | ||
return nil, ert.Err | ||
} | ||
|
||
func WrapWithErrRoundtripper(rt http.RoundTripper) http.RoundTripper { | ||
return &ErrorRoundTripper{Err: rtErr} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.