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:
Simone Basso 2022-05-25 09:54:50 +02:00 committed by GitHub
commit 2d721baa91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 74 additions and 90 deletions

View file

@ -13,7 +13,6 @@ import (
"time"
"github.com/ooni/probe-cli/v3/internal/engine/experiment/urlgetter"
"github.com/ooni/probe-cli/v3/internal/engine/internal/httpfailure"
"github.com/ooni/probe-cli/v3/internal/model"
"github.com/ooni/probe-cli/v3/internal/runtimex"
)
@ -109,11 +108,11 @@ func (tk *TestKeys) Update(v urlgetter.MultiOutput) {
if failure != nil {
// nothing to do here
} else if v.TestKeys.HTTPResponseStatus != 302 {
failure = &httpfailure.UnexpectedStatusCode
failure = &model.HTTPUnexpectedStatusCode
} else if len(v.TestKeys.HTTPResponseLocations) != 1 {
failure = &httpfailure.UnexpectedRedirectURL
failure = &model.HTTPUnexpectedRedirectURL
} else if v.TestKeys.HTTPResponseLocations[0] != WebHTTPSURL {
failure = &httpfailure.UnexpectedRedirectURL
failure = &model.HTTPUnexpectedRedirectURL
}
tk.WhatsappHTTPFailure = failure
}