0
:( /check route confirms whether username is available
route did not return true when username is available
Log
sending GET request to /check?username=check50student1
checking that status code 200 is returned...

That's what I'm getting.

However that's exactly what I'm responding with:

DEBUG:cs50:SELECT id FROM users WHERE username = 'check50student1'
192.168.122.54 - - [06/Dec/2019 14:11:06] "GET /check?username=check50student1 HTTP/1.0" 200 -
INFO:werkzeug:192.168.122.54 - - [06/Dec/2019 14:11:06] "GET /check?username=check50student1 HTTP/1.0" 200 -

Could it be that the key of the answer in JSON is also checked? I'm responding with this:

{"available":true}
1

It does check the value, as it is specified in the problem description.

https://docs.cs50.net/2019/x/psets/8/finance/finance.html#check

  • If the value of username is of length at least 1 and does not already belong to a user in the database, the route should return, in JSON format, true, signifying that the username is (as of that moment) available. Else it should return, in JSON format, false. Recall that jsonify in Flask can return a value in JSON format.

That's just the boolean value, no place for adding extra information, only the plain boolean. So you should return jsonify(True) or jsonify(False) (or something equivalent).

| improve this answer | |
  • Thank you, you we're right! – Talim Dec 6 '19 at 15:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .