if corsOrigin =? allowedOrigin:
resp.setCorsHeaders("GET", corsOrigin)
resp.setHeader("Access-Control-Headers", "X-Requested-With")
The reason is that the headers are explicitly added when the API returns an error response, but when the response is successful, nim-presto handles that. As a result, the previous lines are adding a duplicate Access-Control-Allow-Origin header in the browser, which raises an error.
The following lines are not needed:
The reason is that the headers are explicitly added when the API returns an error response, but when the response is successful, nim-presto handles that. As a result, the previous lines are adding a duplicate Access-Control-Allow-Origin header in the browser, which raises an error.
This PR addresses this issue.