From dec4052b58c1bafc8a503a4faf7675aea66b564a Mon Sep 17 00:00:00 2001 From: Andreas Nareike Date: Tue, 22 Sep 2015 12:52:08 +0200 Subject: [PATCH] change Accepts to specific type in request header Short explanation: When using the AngularJS httpProvider, the default header for requests contains (see [1]): ``` Accept: application/json, text/plain, * / * ``` Note that there are no quality values. Some servers will not respect the order of the MIME types and will answer with any type of the highest quality. This wouldn't be too bad if only the VSB (or rather jassa) could digest text/plain SPARQL results. Unfortunately, it cannot and throws an error. This commit fixes this behaviour. 1. https://docs.angularjs.org/api/ng/service/$http --- app/modules/EndPointService.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/modules/EndPointService.js b/app/modules/EndPointService.js index 8ceb4e7..847e915 100644 --- a/app/modules/EndPointService.js +++ b/app/modules/EndPointService.js @@ -23,6 +23,7 @@ options.timeout = cancelPendingRequest.promise; options.params = options.data; + options.headers = { 'Accept' : 'application/sparql-results+json' }; delete (options.data); $http(options).success(httpRequest.resolve).error(httpRequest.reject); @@ -287,4 +288,4 @@ } -})(); \ No newline at end of file +})();