I suggest a rework of the query route. Currently, the cypher string is passed through a URL path variable but do to URL encoding some character are lost in the process like the '+' character. So modifying the request to make the variables pass through the body of the request like bellow would solve those problems.
# Query endpoint
@router.get('/q', response_model=Query, summary='Query the database with a custom Cypher string')
async def cypher_query(attributes: dict):
print(attributes["cypher_string"])
if attributes["cypher_string"] is not None and attributes["cypher_string"] != "":
with neo4j_driver.session() as session:
response = session.run(query=attributes["cypher_string"])
return Query(response=response.data())
else:
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
detail="Empty or null cypher string.",
headers={"WWW-Authenticate": "Bearer"})
I suggest a rework of the query route. Currently, the cypher string is passed through a URL path variable but do to URL encoding some character are lost in the process like the '+' character. So modifying the request to make the variables pass through the body of the request like bellow would solve those problems.