Closed edmondchuc closed 10 months ago
@lalewis1 could you please test this locally, you can use postman (I use a similar service called Hoppscotch) Could you do a SPARQL query that includes something like:
{
VALUES ?EscapedSearchTerm {"\"Illumina HiSeq 4000\"" "Illumina HiSeq 4000"
}
Could you also add/create a test_endpoints_sparql.py
file with queries in different query= formats
For some reason, the previous implementation won't work with query parameters passed to the
httpx.URL
object as the result becomes a double URL encoded value. This happens when we send a SPARQL query using Postman but not via the Yasgui client.Postman:
Testing with https://meyerweb.com/eric/tools/dencoder/, it requires the value to be decoded twice.
Using FastAPI/Starlette to decode and then performing percent encoding using
urllib.parse.quote_plus
:This PR fixes this issue by getting FastAPI/Starlette to always decode the incoming query parameter and encoding it ourselves using
urllib.parse.quote_plus
. By doing this, it doesn't look likehttpx.URL
will double encode the value.I've also refactored the code slightly to keep all concerns with incoming HTTP in the route handler.