# Buggy code
def _vault_jobs_output_response(self, request, full_url, headers):
    vault_name = full_url.split("/")[-4]
    job_id = full_url.split("/")[-2]

    vault = self.backend.get_vault(vault_name)
    output = vault.get_job_output(job_id)
    headers["content-type"] = "application/octet-stream"
    return 200, headers, output


# Traceback (AttributeError)
127.0.0.1 - - [06/Sep/2017 14:40:32] "POST /kefo/vaults/testvault/archives HTTP/1.1" 500 -
Error on request:
Traceback (most recent call last):
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/werkzeug/serving.py", line 209, in run_wsgi
execute(self.server.app)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/werkzeug/serving.py", line 197, in execute
application_iter = app(environ, start_response)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/moto/server.py", line 92, in __call__
return backend_app(environ, start_response)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1997, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/moto/core/utils.py", line 131, in __call__
result = self.callback(request, request.url, {})
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/moto/glacier/responses.py", line 71, in vault_archive_response
return response_instance._vault_archive_response(request, full_url, headers)
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/moto/glacier/responses.py", line 75, in _vault_archive_response
body = request.body
File "/Users/kford1/Work/motoenv/lib/python3.5/site-packages/werkzeug/local.py", line 347, in __getattr__
return getattr(self._get_current_object(), name)
AttributeError: 'Request' object has no attribute 'body'

# Fixed code
def _vault_jobs_output_response(self, request, full_url, headers):
    vault_name = full_url.split("/")[-4]
    job_id = full_url.split("/")[-2]
    vault = self.backend.get_vault(vault_name)
    if vault.job_ready(job_id):
        output = vault.get_job_output(job_id)
        if isinstance(output, dict):
            headers["content-type"] = "application/json"
            return 200, headers, json.dumps(output)
        else:
            headers["content-type"] = "application/octet-stream"
            return 200, headers, output
    else:
        return 404, headers, "404 Not Found"