aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-09-02 09:26:59 +0300
committerBonfaceKilz2024-09-05 16:39:14 +0300
commit3fe11df19d4f7c1a60a3180e06dd592fdc32f1f1 (patch)
tree9497e2b246bf57fa0fe5b293d7d7946611f8ab22 /gn3
parent74337eb0c3df90215e029989ac01679f75dbd58a (diff)
downloadgenenetwork3-3fe11df19d4f7c1a60a3180e06dd592fdc32f1f1.tar.gz
Use the correct header to request json-ld data.
In HTTP, we use content negotiation to server different representations of a resource to the same URI to help the user agent specify which representation is best suited for the user: <https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation> The "Accept" requet HTTP indicates which content types the user is supposed to understand: <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept> * gn3/api/metadata_api/wiki.py (get_wiki_entries): Use the "Accept" header. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3')
-rw-r--r--gn3/api/metadata_api/wiki.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/gn3/api/metadata_api/wiki.py b/gn3/api/metadata_api/wiki.py
index 0e05b67..0b71c04 100644
--- a/gn3/api/metadata_api/wiki.py
+++ b/gn3/api/metadata_api/wiki.py
@@ -72,7 +72,6 @@ def edit_wiki(comment_id: int):
@wiki_blueprint.route("/<string:symbol>", methods=["GET"])
def get_wiki_entries(symbol: str):
"""Fetch wiki entries"""
- content_type = request.headers.get("Content-Type")
status_code = 200
response = get_wiki_entries_by_symbol(
symbol=symbol,
@@ -81,7 +80,7 @@ def get_wiki_entries(symbol: str):
if not data:
data = {}
status_code = 404
- if content_type == "application/ld+json":
+ if request.headers.get("Accept") == "application/ld+json":
payload = make_response(response)
payload.headers["Content-Type"] = "application/ld+json"
return payload, status_code