mconf / api-mate

A tool to access the API of BigBlueButton and Mconf
http://mconf.github.io/api-mate
Other
39 stars 56 forks source link

Sending POST request returns with error but is not the case #4

Open GhaziTriki opened 8 years ago

GhaziTriki commented 8 years ago

When sending a POST request we get an error message : Server responded with status: 0: error. But what truly happens is that the message is sent, correctly handled and we get the XML answer back.

daronco commented 8 years ago

Where do you see this error? In your browser's JS console?

GhaziTriki commented 8 years ago

This error is visible in the browser.

daronco commented 8 years ago

You mean this message below?

screenshot from 2016-02-12 12-17-29

It is shown if the server responds with a status other than 200. Do you know the status your server is sending with the response?

Maybe checking status != 200 is bad, I'm thinking that it should accept all 2xx statuses as a success.

GhaziTriki commented 8 years ago

I am doing test directly on the default server :smile:

Here is the HTTP headers for the response of /api request

    HTTP/1.1 200 OK
Server  nginx/1.4.6 (Ubuntu)
Date    Sun, 14 Feb 2016 09:07:23 GMT
Content-Type    text/xml;charset=utf-8
Transfer-Encoding   chunked
Connection  keep-alive
Cache-Control   no-cache
P3P CP="No P3P policy available"
Expires 0
daronco commented 8 years ago

Hm, I see a 200 when inspecting the response in the browser as well. But jQuery returns a status 0 with a "very descriptive" error that says error. But the content of the response is empty, so BigBlueButton is not really responding with the XML.

Don't you get the error below in the console?

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://test-install.blindsidenetworks.com/bigbluebutton/api/. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

I see it. This is what is expected, since the server needs to have CORS configured to accept requests from a browser in another domain.