racemap/elevation-service

POST not working in https://elevation.racemap.com/api

jjimenezshaw opened this issue · 5 comments

I am trying to do a POST request (with a few points) to https://elevation.racemap.com/api, and I get an Error 405. Is POST enabled?

This works for me:

curl -d '[[51.3, 13.4], [51.4, 13.3]]' -XPOST -H 'Content-Type: application/json' https://elevation.racemap.com/api

I am calling from Javascript.
I get exactly this:

OPTIONS https://elevation.racemap.com/api 405 (twice)

Access to fetch at 'https://elevation.racemap.com/api' from origin 'http://mini' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

when I call with:

    fetch('https://elevation.racemap.com/api', {
        method: 'POST',
        body: objStr,
        headers:{
            'Content-Type': 'application/json',
            'Accept': 'application/json',
        }
    })
    .then(response => {
        return response.json();
    })

Note: it also works for me using the curl command

Ah, I see. I'll fix the cors issue.

Fixed in 3e76258. Can you please try again now?

Now works! Thanks.