factset / quart-openapi

Module for Quart to add Flask-RESTPlus like functionality
https://factset.github.io/quart-openapi/
Other
82 stars 22 forks source link

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

Closed Fyzethh closed 5 years ago

Fyzethh commented 5 years ago

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.

Fyzethh commented 5 years ago

forget it, it was a configuration error of nginx