Skip to content

Commit

Permalink
fix: set correct Accept header for CONSTRUCT queries
Browse files Browse the repository at this point in the history
  • Loading branch information
simontaurus committed May 4, 2024
1 parent 111f65b commit 2402229
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/Sparql/Client.php
Expand Up @@ -311,6 +311,13 @@ protected function executeQuery($processed_query, $type)
'application/sparql-results+json' => 1.0,
'application/sparql-results+xml' => 0.8
);
$sparql_graph_types = array(
'application/ld+json' => 1.0,
'application/rdf+xml' => 0.9,
'text/turtle' => 0.8,
'application/n-quads' => 0.7,
'application/n-triples' => 0.7,
);

if ($type == 'update') {
// accept anything, as "response body of a […] update request is implementation defined"
Expand Down Expand Up @@ -341,7 +348,7 @@ protected function executeQuery($processed_query, $type)
$accept = Format::formatAcceptHeader($sparql_results_types);
} elseif ($query_verb === 'CONSTRUCT' or $query_verb === 'DESCRIBE') {
// only "graph"
$accept = Format::getHttpAcceptHeader();
$accept = Format::formatAcceptHeader($sparql_graph_types);
} else {
// both
$accept = Format::getHttpAcceptHeader($sparql_results_types);
Expand Down

0 comments on commit 2402229

Please sign in to comment.