h2non / gock

HTTP traffic mocking and testing made easy in Go ༼ʘ̚ل͜ʘ̚༽
https://pkg.go.dev/github.com/h2non/gock
MIT License
2.04k stars 106 forks source link

not matching GET request #94

Closed giulianozor closed 2 years ago

giulianozor commented 2 years ago

Hi, I have a request that I can not match ...

versions

gock v1.1.2
go 1.17.3

code:

        res := models.Test{
        ID:       1
    }
        params := map[string]string{"id": "1"}
    gock.New("test:3000").Get("/api/v1/test/").MatchParams(params).Reply(http.StatusOK).JSON(res)
    gock.Observe(gock.DumpRequest)
    defer gock.Off()

Output```

GET /api/v1/test/?id=1 HTTP/1.1 Host: test:3000 User-Agent: Go-http-client/1.1 Authorization: Bearer a Content-Type: application/json Accept-Encoding: gzip

Matches: false



Any idea about what I am missing ?

Other mocks with similar data are working fine...

thanks