fix tests vs running
parent
352eff2691
commit
0e3e6c54de
|
|
@ -29,9 +29,9 @@ func TestOne(t *testing.T) {
|
||||||
},
|
},
|
||||||
"feeds": func(t *testing.T) context.Context {
|
"feeds": func(t *testing.T) context.Context {
|
||||||
gets := []string{}
|
gets := []string{}
|
||||||
sURL := "http://localhost:10000/"
|
sURL := "http://localhost:10001/"
|
||||||
s := &http.Server{
|
s := &http.Server{
|
||||||
Addr: ":10000",
|
Addr: ":10001",
|
||||||
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
gets = append(gets, r.URL.String())
|
gets = append(gets, r.URL.String())
|
||||||
rb, _ := io.ReadAll(r.Body)
|
rb, _ := io.ReadAll(r.Body)
|
||||||
|
|
@ -43,6 +43,7 @@ func TestOne(t *testing.T) {
|
||||||
case "10":
|
case "10":
|
||||||
case "11":
|
case "11":
|
||||||
default:
|
default:
|
||||||
|
t.Logf("%s => 404", r.URL)
|
||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ func proxyFetch(ctx context.Context, u string) (string, error) {
|
||||||
b, _ := io.ReadAll(resp.Body)
|
b, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
return "", fmt.Errorf("failed fetch: (%d) %s", resp.StatusCode, b)
|
return "", fmt.Errorf("failed fetch %s %s: (%d) %s", req.Method, req.URL.String(), resp.StatusCode, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
return string(b), nil
|
return string(b), nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue