prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Error responses missing OK property and correct HTTP Status Code
  Hello there,
  when making an invalid request, say,  an invalid token, an error is given but the HTTP code is still `200 OK` when it should give an authentication error (a `400 Bad Request` or even a `401 Unauthorized`).
  
  Request:
  ```http
  GET /roombookings/rooms?token=uclapi-5d58c3c4e6bf9c-c2910ad3b6e054-7ef60f44f1c14f-a05147bfd17fdb HTTP/1.1
  Host: uclapi.com
  User-Agent: Paw/3.0.16 (Macintosh; OS X/10.12.4) NSURLConnection/1349.63
  Cookie: AWSALB=8q9+FZmk9TOAZ/GG2tFsVUuckVO8STONoiGDn6/jd9FBEwFi5Ke/kvz+hIjdCmAwtpOIXGlnudL7LU3AaVxKt1sHWYGjLJnoMypHqu53r7Ub4b73trfiMx5NMVZ6
  ```
  
  Response:
  ```http
  HTTP/1.1 200 OK
  Connection: keep-alive
  Content-Type: application/json
  Allow: GET, OPTIONS
  Server: nginx/1.11.10
  Set-Cookie: AWSALB=U2qTk7k+LrfxXibfskgPN1RoWvDQqKhaSBmgvUMOa3AcYgag1BZMcyz+5h5rQ2qhQc+Cm2PYzfjKV466PHcc9dleZHkLYE5O8d5q2WO+7WVbQT6VQMSSSHpOh3xy; Expires=Sat, 11 Mar 2017 14:18:40 GMT; Path=/
  Transfer-Encoding: Identity
  Date: Sat, 04 Mar 2017 14:18:40 GMT
  X-Frame-Options: SAMEORIGIN
  Vary: Accept, Cookie
  
  {"error": "Token does not exist"}
  ```
  
  Furthermore, when a request is successful, the first property is an `"ok": true`, however, with invalid requests, the `"ok": false` is missing from the error response.
  
  Actual:
  ```json
  {
    "error": "Token does not exist"
  }
  ```
  
  Expected:
  ```json
  {
    "ok": false,
    "error": "Token does not exist"
  }
  ```
  
  </issue>
  <code>
  [start of backend/uclapi/roombookings/token_auth.py]
  1 from rest_framework.response import Response
  2 from dashboard.models import App
  3 from django.core.exceptions import ObjectDoesNotExist
  4 from django.http import JsonResponse
  5 
  6 
  7 def does_token_exist(view_func):
  8     def wrapped(request, *args, **kwargs):
  9         token = request.GET.get("token")
  10 
  11         if not token:
  12             return JsonResponse({
  13                 "error": "No token provided"
  14             })
  15 
  16         try:
  17             App.objects.get(api_token=token)
  18         except ObjectDoesNotExist:
  19             return JsonResponse({
  20                 "error": "Token does not exist"
  21             })
  22 
  23         return view_func(request, *args, **kwargs)
  24     return wrapped
  25
  [end of backend/uclapi/roombookings/token_auth.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/backend/uclapi/roombookings/token_auth.py b/backend/uclapi/roombookings/token_auth.py
  --- a/backend/uclapi/roombookings/token_auth.py
  +++ b/backend/uclapi/roombookings/token_auth.py
  @@ -1,4 +1,3 @@
  -from rest_framework.response import Response
   from dashboard.models import App
   from django.core.exceptions import ObjectDoesNotExist
   from django.http import JsonResponse
  @@ -9,16 +8,22 @@
           token = request.GET.get("token")
   
           if not token:
  -            return JsonResponse({
  +            response = JsonResponse({
  +                "ok": False,
                   "error": "No token provided"
               })
  +            response.status_code = 400
  +            return response
   
           try:
               App.objects.get(api_token=token)
           except ObjectDoesNotExist:
  -            return JsonResponse({
  +            response = JsonResponse({
  +                "ok": False,
                   "error": "Token does not exist"
               })
  +            response.status_code = 400
  +            return response
   
           return view_func(request, *args, **kwargs)
       return wrapped
  
verification_info: {"golden_diff": "diff --git a/backend/uclapi/roombookings/token_auth.py b/backend/uclapi/roombookings/token_auth.py\n--- a/backend/uclapi/roombookings/token_auth.py\n+++ b/backend/uclapi/roombookings/token_auth.py\n@@ -1,4 +1,3 @@\n-from rest_framework.response import Response\n from dashboard.models import App\n from django.core.exceptions import ObjectDoesNotExist\n from django.http import JsonResponse\n@@ -9,16 +8,22 @@\n         token = request.GET.get(\"token\")\n \n         if not token:\n-            return JsonResponse({\n+            response = JsonResponse({\n+                \"ok\": False,\n                 \"error\": \"No token provided\"\n             })\n+            response.status_code = 400\n+            return response\n \n         try:\n             App.objects.get(api_token=token)\n         except ObjectDoesNotExist:\n-            return JsonResponse({\n+            response = JsonResponse({\n+                \"ok\": False,\n                 \"error\": \"Token does not exist\"\n             })\n+            response.status_code = 400\n+            return response\n \n         return view_func(request, *args, **kwargs)\n     return wrapped\n", "issue": "Error responses missing OK property and correct HTTP Status Code\nHello there,\r\nwhen making an invalid request, say,  an invalid token, an error is given but the HTTP code is still `200 OK` when it should give an authentication error (a `400 Bad Request` or even a `401 Unauthorized`).\r\n\r\nRequest:\r\n```http\r\nGET /roombookings/rooms?token=uclapi-5d58c3c4e6bf9c-c2910ad3b6e054-7ef60f44f1c14f-a05147bfd17fdb HTTP/1.1\r\nHost: uclapi.com\r\nUser-Agent: Paw/3.0.16 (Macintosh; OS X/10.12.4) NSURLConnection/1349.63\r\nCookie: AWSALB=8q9+FZmk9TOAZ/GG2tFsVUuckVO8STONoiGDn6/jd9FBEwFi5Ke/kvz+hIjdCmAwtpOIXGlnudL7LU3AaVxKt1sHWYGjLJnoMypHqu53r7Ub4b73trfiMx5NMVZ6\r\n```\r\n\r\nResponse:\r\n```http\r\nHTTP/1.1 200 OK\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nAllow: GET, OPTIONS\r\nServer: nginx/1.11.10\r\nSet-Cookie: AWSALB=U2qTk7k+LrfxXibfskgPN1RoWvDQqKhaSBmgvUMOa3AcYgag1BZMcyz+5h5rQ2qhQc+Cm2PYzfjKV466PHcc9dleZHkLYE5O8d5q2WO+7WVbQT6VQMSSSHpOh3xy; Expires=Sat, 11 Mar 2017 14:18:40 GMT; Path=/\r\nTransfer-Encoding: Identity\r\nDate: Sat, 04 Mar 2017 14:18:40 GMT\r\nX-Frame-Options: SAMEORIGIN\r\nVary: Accept, Cookie\r\n\r\n{\"error\": \"Token does not exist\"}\r\n```\r\n\r\nFurthermore, when a request is successful, the first property is an `\"ok\": true`, however, with invalid requests, the `\"ok\": false` is missing from the error response.\r\n\r\nActual:\r\n```json\r\n{\r\n  \"error\": \"Token does not exist\"\r\n}\r\n```\r\n\r\nExpected:\r\n```json\r\n{\r\n  \"ok\": false,\r\n  \"error\": \"Token does not exist\"\r\n}\r\n```\n", "before_files": [{"content": "from rest_framework.response import Response\nfrom dashboard.models import App\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.http import JsonResponse\n\n\ndef does_token_exist(view_func):\n    def wrapped(request, *args, **kwargs):\n        token = request.GET.get(\"token\")\n\n        if not token:\n            return JsonResponse({\n                \"error\": \"No token provided\"\n            })\n\n        try:\n            App.objects.get(api_token=token)\n        except ObjectDoesNotExist:\n            return JsonResponse({\n                \"error\": \"Token does not exist\"\n            })\n\n        return view_func(request, *args, **kwargs)\n    return wrapped\n", "path": "backend/uclapi/roombookings/token_auth.py"}]}