Skip to content

Fix scoring endpoint HTTP behavior #110

@algattik

Description

@algattik
  1. Scoring endpoint should return json, not stringified json
curl -H "Authorization: Bearer $token" $scoringUri \
  -d '{"data":[[1,2,3,4,5,6,7,8,9,10],[10,9,8,7,6,5,4,3,2,1]]}' \
  -H Content-type:application/json

Returns:

"{\"result\": [5113.099642122809, 3713.6329271385334]}"

Expected:

{"result": [5113.099642122809, 3713.6329271385334]}

Probably we should avoid json.dumps() in:

return json.dumps({"result": result.tolist()})

  1. Scoring endpoint should not return 200 in case of error

Exceptions are swallowed at

except Exception as e:

The code should not only return the error message but also set an appropriate HTTP return code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions