rombert / ereviewboard

A mylyn-based Eclipse integration for Review Board
46 stars 31 forks source link

Explicitly set JSON as the Accept MIME type #99

Closed lucianocheng closed 12 years ago

lucianocheng commented 12 years ago

My Eclipse ereviewboard instance is returning XML instead of JSON when querying the API.

When selecting "Team -> Create Review Request", it fires off the following request:

https://reviewboardtest.lucianocheng.com/api/users/?start=0&max-results=50

But shows the following error:

Failed updating the repository data for Reviewboard : The server has responded with an invalid JSon object : A JSONObject text must begin with '{' at character 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

... When I test the request using REST Console in chrome with no Accept header, it returns JSON as expected. It doesn't look like the MIME type is ever explicitly set in the code. Not sure why this is occurring. API docs are here for reference from others: http://www.reviewboard.org/docs/manual/dev/webapi/2.0/overview/#id1 Thanks!
rombert commented 12 years ago

Thanks for reporting this.

Does adding the Accept header actually fix your problem? I remember changing the code a couple of times regarding Accept headers, so I'd like to be sure it's the right fix.

Also, what error does reviewboard report? This is not actual XML being returned - the API has a different format - but an HTML error page.

lucianocheng commented 12 years ago

Ah, I didn't know it was an error.

So I haven't been able to test changing the Accept header directly in Eclipse, I just copy / pasted the request and fiddled with it in chrome REST Console.

I'm new to the world of Eclipse plugin programming, is there a way to run the plugin in debug mode to gather output? Or should I download it and build it?

lucianocheng commented 12 years ago

Hey, this turned out to be an issue with our server throwing a 500. Thanks again!