Skip to content

Commit

Permalink
Use first mime type from match list, update test
Browse files Browse the repository at this point in the history
  • Loading branch information
datadavev committed Jul 4, 2023
1 parent 150754e commit d58a0c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/rdflib_endpoint/sparql_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ async def sparql_endpoint(request: Request, query: Optional[str] = Query(None))
for mime_type in mime_types:
if mime_type in CONTENT_TYPE_TO_RDFLIB_FORMAT:
output_mime_type = mime_type
# Use the first mime_type that matches
break

# Handle mime type for construct queries
if query_operation == "Construct Query":
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rdflib_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_multiple_accept():
response = endpoint.get(
"/",
params={"query": concat_select},
headers={"accept": "text/html;q=0.3, application/xml, application/json;q=0.9, */*;q=0.8"},
headers={"accept": "text/html;q=0.3, application/xml;q=0.9, application/json, */*;q=0.8"},
# Returns JSON
)
assert response.status_code == 200
Expand Down

0 comments on commit d58a0c7

Please sign in to comment.