Skip to content

Commit 92f34cf

Browse files
committed
fix: improve error handling and testing across the codebase
- Add a check to return an error if `t.origin` is nil in the `RoundTrip` method Signed-off-by: appleboy <[email protected]>
1 parent b406c9f commit 92f34cf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

proxy/proxy.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ type defaultHeaderTransport struct {
4040
// from the defaultHeaderTransport to the request before
4141
// delegating the actual round-trip to the original transport.
4242
func (t *defaultHeaderTransport) RoundTrip(req *http.Request) (*http.Response, error) {
43+
if t.origin == nil {
44+
return nil, fmt.Errorf("origin RoundTripper is nil")
45+
}
4346
for key, values := range t.header {
4447
for _, value := range values {
4548
req.Header.Add(key, value)

0 commit comments

Comments
 (0)