dataloader icon indicating copy to clipboard operation
dataloader copied to clipboard

Accept headers not set

Open antiquechrono opened this issue 8 years ago • 1 comments

I just ran into an issue where Firefox wouldn't load any json graphs whereas Chrome would. It seems that Firefox sets a very specific accept header

text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8

that sets other accepted formats whereas chrome sets it as / . The particular service I'm pulling data from can return xml or json depending on the accept headers and was choosing to return xml since the default header includes it.

It seems to me that a sensible default would be to set application/json or text/csv based on what is specified in the dataLoader section with the option to override the defaults through the use of the headers array which is what I used to fix this problem.

Also, the fact that you can specify the accept headers is not specified on this page http://www.amcharts.com/tutorials/using-data-loader-plugin/

antiquechrono avatar Oct 28 '15 07:10 antiquechrono

Hi there,

We do not set any specific headers for the requests. However, you can use headers array to override specific headers for all Data Loader requests:

"dataLoader": {
  "url": "data/serial.json",
  "format": "json",
  "headers": [{
    "key": "Accept",
    "value": "application/javascript, application/json"
  }]
}

I hope this helps.

martynasma avatar Nov 06 '15 12:11 martynasma