factset/quart-openapi

getting duplicate Acces-Control-Allow-Origin on responses statuscodes < 300

Closed this issue · 1 comments

Im using the quart_openapi.cors function called crossdomain for cors.

when i response for example:

return jsonify(uuid=response_json['id']), 201

im getting the following error:

Access to XMLHttpRequest at '{my.domain}' from origin 'http://localhost:3000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed.

and if response a status code > 400, i have no cors issues.

this is a example of my code:

from quart_openapi import Resource
from quart_openapi.cors import crossdomain
from quart import jsonify, request

from app.main import app

@app.route('/pedidosya/order', methods=['POST', 'OPTIONS'])
class CreatePedidosyaOrder(Resource):
@crossdomain(origin='*')
async def post(self):
params = await request.get_json()
required_params = ['name', 'surname', 'id_number', 'email', 'rider_id', 'amount']

    if params is None:
        errors = [{
            "detail": "request without post data"
        }]
        return jsonify(errors=errors), 400

"""
Help me please, Thanks.

forget it, it was a configuration error of nginx