# Buggy code
def _vault_jobs_response(self, request, full_url, headers):
    method = request.method
    body = request.body
    account_id = full_url.split("/")[1]
    vault_name = full_url.split("/")[-2]

    if method == "GET":
        jobs = self.backend.list_jobs(vault_name)
        headers["content-type"] = "application/json"
        return (
            200,
            headers,
            json.dumps(
                {
                    "JobList": [job.to_dict() for job in jobs],
                    "Marker": None,
                }
            ),
        )
    elif method == "POST":
        json_body = json.loads(body.decode("utf-8"))
        archive_id = json_body["ArchiveId"]
        job_id = self.backend.initiate_job(vault_name, archive_id)
        headers["x-amz-job-id"] = job_id
        headers["Location"] = "/{0}/vaults/{1}/jobs/{2}".format(
            account_id, vault_name, job_id
        )
        return 202, headers, ""


# 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_response(self, request, full_url, headers):
    method = request.method
    if hasattr(request, "body"):
        body = request.body
    else:
        body = request.data
    account_id = full_url.split("/")[1]
    vault_name = full_url.split("/")[-2]

    if method == "GET":
        jobs = self.backend.list_jobs(vault_name)
        headers["content-type"] = "application/json"
        return (
            200,
            headers,
            json.dumps(
                {
                    "JobList": [job.to_dict() for job in jobs],
                    "Marker": None,
                }
            ),
        )
    elif method == "POST":
        json_body = json.loads(body.decode("utf-8"))
        job_type = json_body["Type"]
        archive_id = None
        if "ArchiveId" in json_body:
            archive_id = json_body["ArchiveId"]
        if "Tier" in json_body:
            tier = json_body["Tier"]
        else:
            tier = "Standard"
        job_id = self.backend.initiate_job(vault_name, job_type, tier, archive_id)
        headers["x-amz-job-id"] = job_id
        headers["Location"] = "/{0}/vaults/{1}/jobs/{2}".format(
            account_id, vault_name, job_id
        )
        return 202, headers, ""