summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Simmons <tim.simmons@rackspace.com>2016-06-13 21:00:46 +0100
committerTim Simmons <tim.simmons@rackspace.com>2016-06-15 18:51:11 +0000
commit7d6ac0a875ea35227620b8866e2d30ec6e6efa69 (patch)
tree6781f07c5051f73b7603f37be6629a784bb99f69
parent85de7a459ac92cf5d2becdc94ee1996fd40a4844 (diff)
downloaddesignate-7d6ac0a875ea35227620b8866e2d30ec6e6efa69.tar.gz
Ensure HTTP 204 responses have 0 Content-Length
These calls are misusing Pecan, and result in '' getting serialized to JSON, which has a non-empty content-length and that's against the rules of HTTP closes-bug: 1592153 Change-Id: I1407d29c537273b07ab54c4e58c70d9bc4214759 (cherry picked from commit 3171dd5103aa7295b3947cafc35184ccfb9c9659)
-rw-r--r--designate/api/v2/controllers/zones/tasks/abandon.py5
-rw-r--r--designate/api/v2/controllers/zones/tasks/exports.py4
-rw-r--r--designate/api/v2/controllers/zones/tasks/imports.py4
3 files changed, 9 insertions, 4 deletions
diff --git a/designate/api/v2/controllers/zones/tasks/abandon.py b/designate/api/v2/controllers/zones/tasks/abandon.py
index a6c92d1a..f3df64d3 100644
--- a/designate/api/v2/controllers/zones/tasks/abandon.py
+++ b/designate/api/v2/controllers/zones/tasks/abandon.py
@@ -20,7 +20,9 @@ from designate.api.v2.controllers import rest
class AbandonController(rest.RestController):
- @pecan.expose(template='json:', content_type='application/json')
+ # NOTE: template=None is important here, template='json:' manifests
+ # in this bug: https://bugs.launchpad.net/designate/+bug/1592153
+ @pecan.expose(template=None, content_type='application/json')
@utils.validate_uuid('zone_id')
def post_all(self, zone_id):
"""Abandon a zone"""
@@ -36,7 +38,6 @@ class AbandonController(rest.RestController):
else:
response.status_int = 500
- # NOTE: This is a hack and a half.. But Pecan needs it.
return ''
@pecan.expose(template='json:', content_type='application/json')
diff --git a/designate/api/v2/controllers/zones/tasks/exports.py b/designate/api/v2/controllers/zones/tasks/exports.py
index cc1b33d5..8169f213 100644
--- a/designate/api/v2/controllers/zones/tasks/exports.py
+++ b/designate/api/v2/controllers/zones/tasks/exports.py
@@ -108,7 +108,9 @@ class ZoneExportsController(rest.RestController):
context, criterion, marker, limit, sort_key, sort_dir),
request=request)
- @pecan.expose(template='json:', content_type='application/json')
+ # NOTE: template=None is important here, template='json:' manifests
+ # in this bug: https://bugs.launchpad.net/designate/+bug/1592153
+ @pecan.expose(template=None, content_type='application/json')
@utils.validate_uuid('zone_export_id')
def delete_one(self, zone_export_id):
"""Delete Zone Export"""
diff --git a/designate/api/v2/controllers/zones/tasks/imports.py b/designate/api/v2/controllers/zones/tasks/imports.py
index 747640f8..225a2436 100644
--- a/designate/api/v2/controllers/zones/tasks/imports.py
+++ b/designate/api/v2/controllers/zones/tasks/imports.py
@@ -92,7 +92,9 @@ class ZoneImportController(rest.RestController):
# Prepare and return the response body
return zone_import
- @pecan.expose(template='json:', content_type='application/json')
+ # NOTE: template=None is important here, template='json:' manifests
+ # in this bug: https://bugs.launchpad.net/designate/+bug/1592153
+ @pecan.expose(template=None, content_type='application/json')
@utils.validate_uuid('zone_import_id')
def delete_one(self, zone_import_id):
"""Delete Zone Import"""