Example #1
0
        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)

            if headers is not None:

                h['Access-Control-Allow-Headers'] = headers

            return resp
Example #2
0
def not_found(error):
    return make_response(jsonify({'error': 'Not found'}), 404)
Example #3
0
def bad_request(error):
    return make_response(jsonify({'error': 'Bad request'}), 400)
Example #4
0
def get_packet_counters():
    packet_counters_response = packet_counters()
    if packet_counters_response is None:
        return make_response(jsonify({'error': 'Internal Server Error'}), 500)
    return packet_counters_response, 200
Example #5
0
def execute_feature_file():
    json_data = request.get_json(force=True)
    params = json_data['params']
    runner = FeatureFileRunner(json_data['params'])
    runner.start()
    return make_response(jsonify({'status': 'OK'}), 200)
Example #6
0
def is_executing():
    execution_status = {'executing': file_service.is_executing()}
    return make_response(jsonify(status=execution_status), 200)
Example #7
0
def internal_server_error(error):
    return make_response(jsonify({'error': 'Internal Server Error'}), 500)