def METHOD_NAME(elasticapm_client):
    try:
        ElasticAPMExtension.client = elasticapm_client
        request = func.HttpRequest(
            "get",
            "/foo/bar",
            headers={
                "Cookie": "foo=bar; baz=bazzinga",
                "traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01",
            },
            body=b"",
        )
        response = func.HttpResponse("", status_code=200, headers={}, mimetype="text/html")
        context = mock.Mock(function_name="foo")
        context.function_name = "foo_function"
        ElasticAPMExtension.pre_invocation_app_level(None, context, {"request": request})
        ElasticAPMExtension.post_invocation_app_level(None, context, func_ret=response)
        transaction = elasticapm_client.events[constants.TRANSACTION][0]
        assert transaction["name"] == "foo_function"
        assert transaction["type"] == "request"
        assert transaction["outcome"] == "success"
        assert transaction["trace_id"] == "0af7651916cd43dd8448eb211c80319c"
        assert transaction["parent_id"] == "b7ad6b7169203331"
        assert transaction["context"]["request"]["method"] == "GET"
        assert transaction["context"]["request"]["cookies"] == {
            "foo": "bar",
            "baz": "bazzinga",
        }
        assert transaction["context"]["request"]["url"]["full"] == "/foo/bar"
        assert transaction["context"]["response"]["status_code"] == 200
    finally:
        ElasticAPMExtension.client = None