def wrapped_function(*args, **kwargs):
    if (automatic_options and (request.method == 'OPTIONS')):
        resp = current_app.make_default_options_response()
    else:
        resp = make_response(f(*args, **kwargs))
    if ((not attach_to_all) and (request.method != 'OPTIONS')):
        return resp
    h = resp.headers
    h['Access-Control-Allow-Origin'] = origin
    h['Access-Control-Allow-Methods'] = get_methods()
    h['Access-Control-Max-Age'] = str(max_age)
    h['Access-Control-Allow-Credentials'] = 'true'
    h['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'
    if (headers is not None):
        h['Access-Control-Allow-Headers'] = headers
    return resp
def wrapped_function(*args, **kwargs):
    if (automatic_options and (request.method == 'OPTIONS')):
        resp = current_app.make_default_options_response()
    else:
        resp = make_response(f(*args, **kwargs))
    if ((not attach_to_all) and (request.method != 'OPTIONS')):
        return resp
    h = resp.headers
    h['Access-Control-Allow-Origin'] = origin
    h['Access-Control-Allow-Methods'] = get_methods()
    h['Access-Control-Max-Age'] = str(max_age)
    h['Access-Control-Allow-Credentials'] = 'true'
    h['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'
    if (headers is not None):
        h['Access-Control-Allow-Headers'] = headers
    return resp