Browse Source

Add 'schemaVersion' field in the shields.io endpoint

Fixes: #566
master
Pēteris Caune 3 years ago
parent
commit
5656515830
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
3 changed files with 8 additions and 2 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +4
    -1
      hc/api/tests/test_badge.py
  3. +3
    -1
      hc/api/views.py

+ 1
- 0
CHANGELOG.md View File

@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file.
- Drop API support for GET, DELETE requests with a request body
- Add missing @csrf_exempt annotations in API views
- Fix the ping handler to reject status codes > 255
- Add 'schemaVersion' field in the shields.io endpoint (#566)
## v1.22.0 - 2020-08-06


+ 4
- 1
hc/api/tests/test_badge.py View File

@ -90,4 +90,7 @@ class BadgeTestCase(BaseTestCase):
def test_it_returns_shields_json(self):
doc = self.client.get(self.shields_url).json()
self.assertEqual(doc, {"label": "foo", "message": "up", "color": "success"})
self.assertEqual(
doc,
{"schemaVersion": 1, "label": "foo", "message": "up", "color": "success"},
)

+ 3
- 1
hc/api/views.py View File

@ -461,7 +461,9 @@ def badge(request, badge_key, signature, tag, fmt):
elif status == "late":
color = "important"
return JsonResponse({"label": label, "message": status, "color": color})
return JsonResponse(
{"schemaVersion": 1, "label": label, "message": status, "color": color}
)
if fmt == "json":
return JsonResponse(


Loading…
Cancel
Save