Skip to content

Commit

Permalink
Makes pgt_jsonbody return a JSON response. Corresponding endpoint in …
Browse files Browse the repository at this point in the history
…graph_init needs to load the object as JSON
  • Loading branch information
pritchardn committed Sep 13, 2022
1 parent 41046b2 commit 9c05412
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions daliuge-translator/dlg/dropmake/web/graph_init.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function graphInit(graphType){
success: function(data) {
// get node count
var nodeCount = 0;
data = JSON.parse(data);
data.nodeDataArray.forEach(element => {
nodeCount++
});
Expand Down
4 changes: 2 additions & 2 deletions daliuge-translator/dlg/dropmake/web/translator_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def jsonbody_get_lg(
raise HTTPException(status_code=404, detail="JSON graph {0} not found\n".format(lg_name))


@app.get("/pgt_jsonbody", tags=["Original"])
@app.get("/pgt_jsonbody", response_class=JSONResponse, tags=["Original"])
def jsonbody_get_pgt(
pgt_name: str = Query(description="The name of the pgt to load from file")
):
Expand All @@ -175,7 +175,7 @@ def jsonbody_get_pgt(
pgt = pgt_path(pgt_dir, pgt_name)
with open(pgt, "r") as f:
data = f.read()
return data
return JSONResponse(data)
else:
raise HTTPException(status_code=404, detail="JSON graph {0} not found".format(pgt_name))

Expand Down

0 comments on commit 9c05412

Please sign in to comment.