Yonah f48506b1ca
generic: net return full response struct
This is still quite easy to stub, and the extra information is very
useful to the caller.

Signed-off-by: Yonah <contrib@gensokyo.uk>
2025-09-19 21:36:33 +09:00

21 lines
395 B
Go

package main
import (
"context"
"net/http"
)
type netDirect struct {
c http.Client
}
func (n *netDirect) Get(ctx context.Context, url string) (*http.Response, error) {
var resp *http.Response
if req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil); err != nil {
return nil, err
} else if resp, err = n.c.Do(req); err != nil {
return nil, err
}
return resp, nil
}