From d81555687e0b3117df98fac33b3bafa8ec15d688 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C4=93teris=20Caune?=
Date: Tue, 18 Aug 2015 10:52:22 +0300
Subject: [PATCH] Test for HEAD method, note about IPv6
---
hc/api/tests/test_ping.py | 9 +++++++++
templates/front/docs.html | 3 ++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/hc/api/tests/test_ping.py b/hc/api/tests/test_ping.py
index 5af5f260..23194888 100644
--- a/hc/api/tests/test_ping.py
+++ b/hc/api/tests/test_ping.py
@@ -26,6 +26,15 @@ class PingTestCase(TestCase):
r = csrf_client.post("/ping/%s/" % check.code)
assert r.status_code == 200
+ def test_head_works(self):
+ check = Check()
+ check.save()
+
+ csrf_client = Client(enforce_csrf_checks=True)
+ r = csrf_client.head("/ping/%s/" % check.code)
+ assert r.status_code == 200
+ assert Ping.objects.count() == 1
+
def test_it_handles_bad_uuid(self):
r = self.client.get("/ping/not-uuid/")
assert r.status_code == 400
diff --git a/templates/front/docs.html b/templates/front/docs.html
index 460dbb68..6d13c7d2 100644
--- a/templates/front/docs.html
+++ b/templates/front/docs.html
@@ -23,7 +23,8 @@ It is all very simple, really.
- HTTP and HTTPS protocols both are fine
- - Request method can be GET or POST
+ - Request method can be GET, POST or HEAD
+ - Both IPv4 and IPv6 work
- It does not matter what request headers you send
- You can leave request body empty or put anything in it, it's all good