API: Fixed response in getUserByToken. returning JSON and not a string
This commit is contained in:
parent
7e2d8914a7
commit
114bbdfe8b
1 changed files with 8 additions and 3 deletions
|
@ -6,7 +6,7 @@ from google.appengine.ext import db
|
|||
import requests
|
||||
import uuid
|
||||
|
||||
from flask import Flask, request, render_template, redirect, abort
|
||||
from flask import Flask, request, render_template, redirect, abort, Response
|
||||
|
||||
from flask.ext.github import GitHub
|
||||
from flask.ext.cors import CORS, cross_origin
|
||||
|
@ -62,9 +62,14 @@ def getUserByToken(token):
|
|||
query.filter("seToken = ", token)
|
||||
|
||||
for u in query.run(limit=5):
|
||||
return u.to_JSON()
|
||||
return Response(response=u.to_JSON(),
|
||||
status=201,
|
||||
mimetype="application/json") # Real response!
|
||||
|
||||
return Response(response=json.dumps({'message' : 'No User Found'}),
|
||||
status=403,
|
||||
mimetype="application/json")
|
||||
|
||||
return json.dumps({'message' : 'No User Found'}), 403
|
||||
|
||||
|
||||
@app.route('/githubOAuth')
|
||||
|
|
Loading…
Reference in a new issue