From 0c6654ec8bd71297ca7d97899933f98d526b6725 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 30 Mar 2022 11:28:00 +0300 Subject: 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. --- gn3/api/correlation.py | 3 +-- 1 file changed, 1 insertion(+), 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: -- cgit v1.2.3