mattermost/services/httpservice
Jesse Hallam b8eb69281b
MM-23666: rewrite TestHTTPClient (#14236)
* MM-23666: rewrite TestHTTPClient

The existing `TestHTTPClient` actually tries to reach google.com, making it brittle to network hiccups (as unlikely as that might be). Rewrite the test to rely on a local server instead.

I found the existing implementation of `TestHTTPClient` extremely hard to understand, so I've rewritten it more explicitly, expanded coverage somewhat. In doing so, I found myself somewhat surprised by the current behaviour. If `allowHost` returns `true`, we ignore `allowIP` altogether. If `allowHost` returns `false`, we check with `allowIP`. There's a lack of symmetry here that the current filter names don't make clear. Perhaps `allowHost` should be renamed `skipIPCheckForHost`?

Fixes: https://mattermost.atlassian.net/browse/MM-23666

* more compact assertions
2020-04-08 09:40:42 -03:00
..
client.go Consistent license message for all the go files (#13235) 2019-11-29 12:59:40 +01:00
client_test.go MM-23666: rewrite TestHTTPClient (#14236) 2020-04-08 09:40:42 -03:00
httpservice.go Consistent license message for all the go files (#13235) 2019-11-29 12:59:40 +01:00
transport.go Consistent license message for all the go files (#13235) 2019-11-29 12:59:40 +01:00