Skip to content

Commit

Permalink
Using query length to determine whether to use GET or POST
Browse files Browse the repository at this point in the history
  • Loading branch information
Elfix committed Jul 1, 2023
1 parent 8adc40f commit ab2dc75
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions modules/ext.queryViz.QueryViz.js
Expand Up @@ -232,17 +232,15 @@
break;
}
// Adapts to each service's xhr protocol : post vs get
if (customEndpoint.includes('lingualibre')) {
return $.post(customEndpoint, { format: 'json', query: query });
} else if (customEndpoint.includes('francophones')) {
return $.post({ url: customEndpoint, format: 'json', query: query,
// dataType: 'json',
headers: { 'Accept': 'application/sparql-results+json,*/*;q=0.9' },
'Accept': 'application/sparql-results+json,*/*;q=0.8'
if (query.length > 4000) {
return $.post(customEndpoint, {
format: 'json', query: query, headers: { 'Accept': 'application/sparql-results+json,*/*;q=0.9' }
});
} else {
return $.get(customEndpoint, { format: 'json', query: query });
}

return $.get(customEndpoint, {
format: 'json', query: query, headers: { 'Accept': 'application/sparql-results+json,*/*;q=0.9' }
});
};

QueryViz.prototype.refresh = function() {
Expand Down

0 comments on commit ab2dc75

Please sign in to comment.