Skip to content

Commit

Permalink
fix(oonimkall.HTTPRequest): URL => Url to fix iOS (#1545)
Browse files Browse the repository at this point in the history
Closes: ooni/probe#2701

---------

Co-authored-by: Simone Basso <[email protected]>
  • Loading branch information
aanorbel and bassosimone authored Apr 8, 2024
1 parent 83f4d55 commit d08ce02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions pkg/oonimkall/httpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ type HTTPRequest struct {
// Method is the MANDATORY request method.
Method string

// URL is the MANDATORY request URL.
URL string
// Url is the MANDATORY request URL.
//
// Note: this field MUST be named "Url" not "URL"; see https://github.com/ooni/probe/issues/2701.
Url string
}

// HTTPResponse is an HTTP response.
Expand All @@ -54,7 +56,7 @@ func (sess *Session) HTTPDo(ctx *Context, jreq *HTTPRequest) (*HTTPResponse, err
func (sess *Session) httpDoLocked(ctx *Context, jreq *HTTPRequest) (*HTTPResponse, error) {
clnt := sess.sessp.DefaultHTTPClient()

req, err := http.NewRequestWithContext(ctx.ctx, jreq.Method, jreq.URL, nil)
req, err := http.NewRequestWithContext(ctx.ctx, jreq.Method, jreq.Url, nil)
if err != nil {
return nil, err
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/oonimkall/httpx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestSessionHTTPDo(t *testing.T) {

req := &oonimkall.HTTPRequest{
Method: "GET",
URL: server.URL,
Url: server.URL,
}

sess, err := NewSessionForTesting()
Expand All @@ -55,7 +55,7 @@ func TestSessionHTTPDo(t *testing.T) {

req := &oonimkall.HTTPRequest{
Method: "GET",
URL: "\t", // this URL is invalid
Url: "\t", // this URL is invalid
}

resp, err := sess.HTTPDo(sess.NewContext(), req)
Expand All @@ -75,7 +75,7 @@ func TestSessionHTTPDo(t *testing.T) {

req := &oonimkall.HTTPRequest{
Method: "GET",
URL: server.URL,
Url: server.URL,
}

sess, err := NewSessionForTesting()
Expand Down Expand Up @@ -107,7 +107,7 @@ func TestSessionHTTPDo(t *testing.T) {

req := &oonimkall.HTTPRequest{
Method: "GET",
URL: URL.String(),
Url: URL.String(),
}

sess, err := NewSessionForTesting()
Expand Down Expand Up @@ -142,7 +142,7 @@ func TestSessionHTTPDo(t *testing.T) {

req := &oonimkall.HTTPRequest{
Method: "GET",
URL: server.URL,
Url: server.URL,
}

sess, err := NewSessionForTesting()
Expand Down

0 comments on commit d08ce02

Please sign in to comment.