Merge "Fix function download content-type not set correctly"
This commit is contained in:
commit
52d9a48f76
|
@ -98,7 +98,7 @@ class FunctionsController(rest.RestController):
|
||||||
raise exc.InputException('Failed to validate object in Swift.')
|
raise exc.InputException('Failed to validate object in Swift.')
|
||||||
|
|
||||||
@rest_utils.wrap_pecan_controller_exception
|
@rest_utils.wrap_pecan_controller_exception
|
||||||
@pecan.expose()
|
@pecan.expose(content_type='application/zip')
|
||||||
@pecan.expose('json')
|
@pecan.expose('json')
|
||||||
def get(self, id):
|
def get(self, id):
|
||||||
"""Get function information or download function package.
|
"""Get function information or download function package.
|
||||||
|
@ -139,7 +139,6 @@ class FunctionsController(rest.RestController):
|
||||||
|
|
||||||
pecan.response.app_iter = (f if isinstance(f, collections.Iterable)
|
pecan.response.app_iter = (f if isinstance(f, collections.Iterable)
|
||||||
else FileIter(f))
|
else FileIter(f))
|
||||||
pecan.response.headers['Content-Type'] = 'application/zip'
|
|
||||||
pecan.response.headers['Content-Disposition'] = (
|
pecan.response.headers['Content-Disposition'] = (
|
||||||
'attachment; filename="%s"' % id
|
'attachment; filename="%s"' % id
|
||||||
)
|
)
|
||||||
|
|
|
@ -48,6 +48,7 @@ class FunctionsTest(base.BaseQinlingTest):
|
||||||
# Download function package
|
# Download function package
|
||||||
resp, data = self.client.download_function(function_id)
|
resp, data = self.client.download_function(function_id)
|
||||||
self.assertEqual(200, resp.status)
|
self.assertEqual(200, resp.status)
|
||||||
|
self.assertEqual('application/zip', resp['content-type'])
|
||||||
self.assertEqual(os.path.getsize(self.python_zip_file), len(data))
|
self.assertEqual(os.path.getsize(self.python_zip_file), len(data))
|
||||||
|
|
||||||
# Delete function
|
# Delete function
|
||||||
|
|
Loading…
Reference in New Issue