bcgov / DBC-APIM

DataBC OPEN API Services
Apache License 2.0
1 stars 0 forks source link

API Console: Content-type error #96

Open BK01 opened 6 years ago

BK01 commented 6 years ago

Console used: Route Planner Environment: cad.data Record: test-api-2

Issue: use routertst or router, CORS returned correct header However content-type seems wrong with console, it’s correct when use curl

Test results:

  1. when use curl url -I -X POST "https://routertst.api.gov.bc.ca/directions.json?points=-123.70794%2C48.77869%2C-123.53785%2C48.38200" -H "accept: /" -H "apikey: ****" HTTP/2 200 content-type: application/json

  2. Using POST Console returns 403 with access-control-allow-origin: https://cad.data.gov.bc.ca cache-control: no-cache, no-store, max-age=0, must-revalidate content-type: text/plain; charset=UTF-8 expires: 0 pragma: no-cache

BK01 commented 6 years ago

Re-opened: Actually, this only fails with POST. Our test used GET.

banders commented 6 years ago

@BK01 @ll911 I am not able to reproduce the problem that you reported, although I am observing a different problem:

Requests from curl or from the API console both result in errors.

a. From curl the response is HTTP 403. This is the curl example that I was testing:

curl -X POST "https://router.api.gov.bc.ca/directions.json?points=-123.70794%2C48.77869%2C-123.53785%2C48.38200" -H "accept: /" -H "apikey: ****"

b. From the API console, the browser's preflight request (i.e. the OPTIONS request) fails because the server isn't returning header "access-control-allow-origin".

Could this be a server config problem?

BK01 commented 6 years ago

Will re-test POST with Route Planner console on Weds, March 14

BK01 commented 6 years ago

Repeated UAT today with new API console (3.12.1) in cat.data using POST and received an error.

Response Header:
access-control-allow-origin: https://cat.data.gov.bc.ca cache-control: no-cache, no-store, max-age=0, must-revalidate content-type: text/plain; charset=UTF-8 expires: 0 pragma: no-cache