aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-03-30 11:28:00 +0300
committerFrederick Muriuki Muriithi2022-03-30 11:41:52 +0300
commit0c6654ec8bd71297ca7d97899933f98d526b6725 (patch)
tree577d312ad9e3c36ccee40bcb9091bbbe3468e3ff
parent1d4d6d91172bec1e32fa3632d8c4b13c4e0d31f7 (diff)
downloadgenenetwork3-0c6654ec8bd71297ca7d97899933f98d526b6725.tar.gz
Revert "Run json.loads on request.get_json, since request.get_json was just returning a string"
This reverts commit b93b22386056347d8002dd2e403425beeb4657cd. The appropriate fix should have been in GN2. The original statement args = request.get_json() was correct, since `request.get_json()` should return a python object parsed from the JSON string in the request. Unfortunately, GN2 was encoding the request data two times, which led to the call returning a JSON-encoded string instead of the expected object. The issue has been fixed in GN2 and therefore, the "fix" here can be reverted.
-rw-r--r--gn3/api/correlation.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/gn3/api/correlation.py b/gn3/api/correlation.py
index f2ffe8a..7eb7cd6 100644
--- a/gn3/api/correlation.py
+++ b/gn3/api/correlation.py
@@ -1,5 +1,4 @@
"""Endpoints for running correlations"""
-import json
import sys
from functools import reduce
@@ -111,7 +110,7 @@ def partial_correlation():
return reduce(__field_errors__(request_data), fields, errors)
- args = json.loads(request.get_json())
+ args = request.get_json()
request_errors = __errors__(
args, ("primary_trait", "control_traits", "target_db", "method"))
if request_errors: