Browse Source

Merge "Fix function download content-type not set correctly"

changes/20/583420/1
Zuul 3 years ago
committed by Gerrit Code Review
parent
commit
52d9a48f76
2 changed files with 2 additions and 2 deletions
  1. +1
    -2
      qinling/api/controllers/v1/function.py
  2. +1
    -0
      qinling_tempest_plugin/tests/api/test_functions.py

+ 1
- 2
qinling/api/controllers/v1/function.py View File

@ -98,7 +98,7 @@ class FunctionsController(rest.RestController):
raise exc.InputException('Failed to validate object in Swift.')
@rest_utils.wrap_pecan_controller_exception
@pecan.expose()
@pecan.expose(content_type='application/zip')
@pecan.expose('json')
def get(self, id):
"""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)
else FileIter(f))
pecan.response.headers['Content-Type'] = 'application/zip'
pecan.response.headers['Content-Disposition'] = (
'attachment; filename="%s"' % id
)


+ 1
- 0
qinling_tempest_plugin/tests/api/test_functions.py View File

@ -48,6 +48,7 @@ class FunctionsTest(base.BaseQinlingTest):
# Download function package
resp, data = self.client.download_function(function_id)
self.assertEqual(200, resp.status)
self.assertEqual('application/zip', resp['content-type'])
self.assertEqual(os.path.getsize(self.python_zip_file), len(data))
# Delete function


Loading…
Cancel
Save