cleanup: merge httpheader and httpfailure into model (#758)
These two small packages could easily be merged into the model package, since they're clearly model-like packages. Part of https://github.com/ooni/probe/issues/2115
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/httpheader"
|
||||
"github.com/ooni/probe-cli/v3/internal/httpx"
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
)
|
||||
@@ -21,7 +20,7 @@ func cloudflareIPLookup(
|
||||
BaseURL: "https://www.cloudflare.com",
|
||||
HTTPClient: httpClient,
|
||||
Logger: logger,
|
||||
UserAgent: httpheader.CLIUserAgent(),
|
||||
UserAgent: model.HTTPHeaderUserAgent,
|
||||
}).WithBodyLogging().Build().FetchResource(ctx, "/cdn-cgi/trace")
|
||||
if err != nil {
|
||||
return DefaultProbeIP, err
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/httpheader"
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
)
|
||||
|
||||
func TestIPLookupWorksUsingcloudlflare(t *testing.T) {
|
||||
@@ -15,7 +15,7 @@ func TestIPLookupWorksUsingcloudlflare(t *testing.T) {
|
||||
context.Background(),
|
||||
http.DefaultClient,
|
||||
log.Log,
|
||||
httpheader.UserAgent(),
|
||||
model.HTTPHeaderUserAgent,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/httpheader"
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
"github.com/pion/stun"
|
||||
)
|
||||
|
||||
@@ -128,7 +128,7 @@ func TestIPLookupWorksUsingSTUNEkiga(t *testing.T) {
|
||||
context.Background(),
|
||||
http.DefaultClient,
|
||||
log.Log,
|
||||
httpheader.UserAgent(),
|
||||
model.HTTPHeaderUserAgent,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -143,7 +143,7 @@ func TestIPLookupWorksUsingSTUNGoogle(t *testing.T) {
|
||||
context.Background(),
|
||||
http.DefaultClient,
|
||||
log.Log,
|
||||
httpheader.UserAgent(),
|
||||
model.HTTPHeaderUserAgent,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/httpheader"
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
)
|
||||
|
||||
func TestUbuntuParseError(t *testing.T) {
|
||||
@@ -22,7 +22,7 @@ func TestUbuntuParseError(t *testing.T) {
|
||||
},
|
||||
}},
|
||||
log.Log,
|
||||
httpheader.UserAgent(),
|
||||
model.HTTPHeaderUserAgent,
|
||||
)
|
||||
if err == nil || !strings.HasPrefix(err.Error(), "XML syntax error") {
|
||||
t.Fatalf("not the error we expected: %+v", err)
|
||||
@@ -37,7 +37,7 @@ func TestIPLookupWorksUsingUbuntu(t *testing.T) {
|
||||
context.Background(),
|
||||
http.DefaultClient,
|
||||
log.Log,
|
||||
httpheader.UserAgent(),
|
||||
model.HTTPHeaderUserAgent,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user