mirror of
https://github.com/mpolden/echoip.git
synced 2025-07-17 14:33:30 +02:00
http: Return bad request for invalid requests
This commit is contained in:
@ -160,6 +160,7 @@ func TestJSONHandlers(t *testing.T) {
|
||||
{s.URL + "/port/31337", "{\n \"ip\": \"127.0.0.1\",\n \"port\": 31337,\n \"reachable\": true\n}", 200},
|
||||
{s.URL + "/port/80", "{\n \"ip\": \"127.0.0.1\",\n \"port\": 80,\n \"reachable\": true\n}", 200}, // checking that our test server is reachable on port 80
|
||||
{s.URL + "/port/80?ip=1.3.3.7", "{\n \"ip\": \"127.0.0.1\",\n \"port\": 80,\n \"reachable\": true\n}", 200}, // ensuring that the "ip" parameter is not usable to check remote host ports
|
||||
{s.URL + "/?ip=1.3.3.7/country", "{\n \"error\": \"could not parse IP: 1.3.3.7/country\"\n}", 400},
|
||||
{s.URL + "/foo", "{\n \"error\": \"404 page not found\"\n}", 404},
|
||||
{s.URL + "/health", `{"status":"OK"}`, 200},
|
||||
}
|
||||
|
Reference in New Issue
Block a user