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 3171dd5103
)
This commit is contained in:
parent
85de7a459a
commit
7d6ac0a875
|
@ -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')
|
||||
|
|
|
@ -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"""
|
||||
|
|
|
@ -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"""
|
||||
|
|
Loading…
Reference in New Issue