Skip to content
This repository was archived by the owner on Oct 5, 2023. It is now read-only.

Commit ea50721

Browse files
committed
api: fix failing test
1 parent b8b55cb commit ea50721

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

api_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"net/http/httptest"
99
"os"
1010
"strconv"
11+
"strings"
1112
"sync"
1213
"testing"
1314
"time"
@@ -221,15 +222,14 @@ func Test_NewURLApiWithClient_With_Headers(t *testing.T) {
221222
ts := httptest.NewServer(
222223
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
223224
val := r.Header.Get(headerToTest)
224-
if val == expectedHeaderValue {
225+
if val != expectedHeaderValue {
225226
w.WriteHeader(400)
226227
return
227228
}
228-
w.WriteHeader(200)
229+
http.ServeContent(w, r, "", time.Now(), strings.NewReader("test"))
229230
}),
230231
)
231232
defer ts.Close()
232-
time.Sleep(time.Second * 2)
233233
api, err := NewURLApiWithClient(ts.URL, &http.Client{
234234
Transport: &http.Transport{
235235
Proxy: http.ProxyFromEnvironment,
@@ -240,7 +240,7 @@ func Test_NewURLApiWithClient_With_Headers(t *testing.T) {
240240
t.Fatal(err)
241241
}
242242
api.Headers.Set(headerToTest, expectedHeaderValue)
243-
if _, err := api.Pin().Ls(context.Background()); err != nil {
243+
if err := api.Pin().Rm(context.Background(), path.New("/ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv")); err != nil {
244244
t.Fatal(err)
245245
}
246246
}

0 commit comments

Comments
 (0)