async
This commit is contained in:
@@ -18,7 +18,7 @@ func TestFetch(t *testing.T) {
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
result, err := Fetch(FetchArgs{URL: server.URL})
|
||||
result, err := Fetch(FetchArgs{Input: server.URL})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.True(t, result.OK)
|
||||
@@ -32,7 +32,7 @@ func TestFetch(t *testing.T) {
|
||||
func TestFetchHTTPBin(t *testing.T) {
|
||||
t.Skip("httpbin.org test is flaky")
|
||||
|
||||
result, err := Fetch(FetchArgs{URL: "https://httpbin.org/get"})
|
||||
result, err := Fetch(FetchArgs{Input: "https://httpbin.org/get"})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.True(t, result.OK)
|
||||
@@ -42,7 +42,7 @@ func TestFetchHTTPBin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFetchWith404(t *testing.T) {
|
||||
result, err := Fetch(FetchArgs{URL: "https://httpbin.org/status/404"})
|
||||
result, err := Fetch(FetchArgs{Input: "https://httpbin.org/status/404"})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.False(t, result.OK)
|
||||
@@ -50,7 +50,7 @@ func TestFetchWith404(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFetchWithInvalidURL(t *testing.T) {
|
||||
_, err := Fetch(FetchArgs{URL: "http://this-domain-does-not-exist-12345.com"})
|
||||
_, err := Fetch(FetchArgs{Input: "http://this-domain-does-not-exist-12345.com"})
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "failed to fetch")
|
||||
}
|
||||
@@ -69,9 +69,9 @@ func TestFetchWithHeaders(t *testing.T) {
|
||||
}
|
||||
options := &FetchOptions{
|
||||
Method: "GET",
|
||||
Headers: &headers,
|
||||
Headers: headers,
|
||||
}
|
||||
result, err := Fetch(FetchArgs{URL: server.URL, Options: options})
|
||||
result, err := Fetch(FetchArgs{Input: server.URL, Init: options})
|
||||
require.NoError(t, err)
|
||||
assert.True(t, result.OK)
|
||||
}
|
||||
@@ -85,7 +85,7 @@ func TestFetchDefaults(t *testing.T) {
|
||||
defer server.Close()
|
||||
|
||||
options := &FetchOptions{}
|
||||
result, err := Fetch(FetchArgs{URL: server.URL, Options: options})
|
||||
result, err := Fetch(FetchArgs{Input: server.URL, Init: options})
|
||||
require.NoError(t, err)
|
||||
assert.True(t, result.OK)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user