greybeard

Setjsonurl Not Sending Proper Accepts Header.

Recommended Posts

I have a RESTfull service that produces a response based on the MIME type from the HTTP Accepts header. As part of this response, I set the Content-Type header to the representation chosen.

 

Currently, FusionCharts sets this value to text/plain,*/* even though it only accepts XML and JSON. Since the Accepts header specifies */*, the server is free to pick any representation so I chose application/json. I have tried several methods on the chart (e.g., setJSONUrl, setChartDataUrl, etc) but all complain that the XML is not well formed (I can see in the debug window that it is JSON and not XML).

 

Additionally, FusionCharts appears to ignore the Content-Type return by the service, which would be a big clue that it is receiving JSON and not XML.

 

I have two work-arounds for this:

  1. Only produce XML.
  2. Use another library to fetch the data and then pass it along to FusionCharts.

I don't like #1 because it just seems wrong to increase my payload size without some benefit.

 

I don't like #2 because I am not confident that I can find a library that works the same on all platforms and I am not confident that I won't run into some other issue loading JSON data.

 

Any recommendations?

Share this post


Link to post
Share on other sites

Hi,

 

Internally the chart would only accept XML. However, when you provide JSON, our JavaScript Class converts that JSON to required XML and pass it to the chart. Hence, you will only see debug information regarding XML which seems to be not the actual issue.

 

We would like to check the JSON which you are sending to the chart. Could you please attach here the JSON response so that we can check whether the JSON that you are providing is well formed?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now