prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  __flush__ produces an HTML reponse 
  The response for the flush endpoint is a raw HTML response from Pyramid. I suggest make it a JSON response for compatibility with the rest of the API. Maybe return `{}`?
  
  ```
  gsurita-30820:kinto gsurita$ http post http://localhost:8888/v1/__flush__
  HTTP/1.1 202 Accepted
  Content-Length: 157
  Content-Type: text/html; charset=UTF-8
  Date: Tue, 21 Feb 2017 13:56:56 GMT
  Server: waitress
  X-Content-Type-Options: nosniff
  
  <html>
   <head>
    <title>202 Accepted</title>
   </head>
   <body>
    <h1>202 Accepted</h1>
    The request is accepted for processing.<br/><br/>
  
  
  
   </body>
  </html>
  __flush__ produces an HTML reponse 
  The response for the flush endpoint is a raw HTML response from Pyramid. I suggest make it a JSON response for compatibility with the rest of the API. Maybe return `{}`?
  
  ```
  gsurita-30820:kinto gsurita$ http post http://localhost:8888/v1/__flush__
  HTTP/1.1 202 Accepted
  Content-Length: 157
  Content-Type: text/html; charset=UTF-8
  Date: Tue, 21 Feb 2017 13:56:56 GMT
  Server: waitress
  X-Content-Type-Options: nosniff
  
  <html>
   <head>
    <title>202 Accepted</title>
   </head>
   <body>
    <h1>202 Accepted</h1>
    The request is accepted for processing.<br/><br/>
  
  
  
   </body>
  </html>
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `kinto/views/flush.py`
  Content:
  ```
  1 from cornice import Service
  2 from pyramid import httpexceptions
  3 from pyramid.security import NO_PERMISSION_REQUIRED
  4 
  5 from kinto.events import ServerFlushed
  6 
  7 flush = Service(name='flush',
  8                 description='Clear database content',
  9                 path='/__flush__')
  10 
  11 
  12 @flush.post(permission=NO_PERMISSION_REQUIRED)
  13 def flush_post(request):
  14     request.registry.storage.flush()
  15     request.registry.permission.flush()
  16     request.registry.cache.flush()
  17     event = ServerFlushed(request)
  18     request.registry.notify(event)
  19     return httpexceptions.HTTPAccepted()
  20
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/kinto/views/flush.py b/kinto/views/flush.py
  --- a/kinto/views/flush.py
  +++ b/kinto/views/flush.py
  @@ -1,5 +1,4 @@
   from cornice import Service
  -from pyramid import httpexceptions
   from pyramid.security import NO_PERMISSION_REQUIRED
   
   from kinto.events import ServerFlushed
  @@ -16,4 +15,6 @@
       request.registry.cache.flush()
       event = ServerFlushed(request)
       request.registry.notify(event)
  -    return httpexceptions.HTTPAccepted()
  +
  +    request.response.status = 202
  +    return {}
  
verification_info: {"golden_diff": "diff --git a/kinto/views/flush.py b/kinto/views/flush.py\n--- a/kinto/views/flush.py\n+++ b/kinto/views/flush.py\n@@ -1,5 +1,4 @@\n from cornice import Service\n-from pyramid import httpexceptions\n from pyramid.security import NO_PERMISSION_REQUIRED\n \n from kinto.events import ServerFlushed\n@@ -16,4 +15,6 @@\n     request.registry.cache.flush()\n     event = ServerFlushed(request)\n     request.registry.notify(event)\n-    return httpexceptions.HTTPAccepted()\n+\n+    request.response.status = 202\n+    return {}\n", "issue": "__flush__ produces an HTML reponse \nThe response for the flush endpoint is a raw HTML response from Pyramid. I suggest make it a JSON response for compatibility with the rest of the API. Maybe return `{}`?\r\n\r\n```\r\ngsurita-30820:kinto gsurita$ http post http://localhost:8888/v1/__flush__\r\nHTTP/1.1 202 Accepted\r\nContent-Length: 157\r\nContent-Type: text/html; charset=UTF-8\r\nDate: Tue, 21 Feb 2017 13:56:56 GMT\r\nServer: waitress\r\nX-Content-Type-Options: nosniff\r\n\r\n<html>\r\n <head>\r\n  <title>202 Accepted</title>\r\n </head>\r\n <body>\r\n  <h1>202 Accepted</h1>\r\n  The request is accepted for processing.<br/><br/>\r\n\r\n\r\n\r\n </body>\r\n</html>\n__flush__ produces an HTML reponse \nThe response for the flush endpoint is a raw HTML response from Pyramid. I suggest make it a JSON response for compatibility with the rest of the API. Maybe return `{}`?\r\n\r\n```\r\ngsurita-30820:kinto gsurita$ http post http://localhost:8888/v1/__flush__\r\nHTTP/1.1 202 Accepted\r\nContent-Length: 157\r\nContent-Type: text/html; charset=UTF-8\r\nDate: Tue, 21 Feb 2017 13:56:56 GMT\r\nServer: waitress\r\nX-Content-Type-Options: nosniff\r\n\r\n<html>\r\n <head>\r\n  <title>202 Accepted</title>\r\n </head>\r\n <body>\r\n  <h1>202 Accepted</h1>\r\n  The request is accepted for processing.<br/><br/>\r\n\r\n\r\n\r\n </body>\r\n</html>\n", "before_files": [{"content": "from cornice import Service\nfrom pyramid import httpexceptions\nfrom pyramid.security import NO_PERMISSION_REQUIRED\n\nfrom kinto.events import ServerFlushed\n\nflush = Service(name='flush',\n                description='Clear database content',\n                path='/__flush__')\n\n\n@flush.post(permission=NO_PERMISSION_REQUIRED)\ndef flush_post(request):\n    request.registry.storage.flush()\n    request.registry.permission.flush()\n    request.registry.cache.flush()\n    event = ServerFlushed(request)\n    request.registry.notify(event)\n    return httpexceptions.HTTPAccepted()\n", "path": "kinto/views/flush.py"}], "after_files": [{"content": "from cornice import Service\nfrom pyramid.security import NO_PERMISSION_REQUIRED\n\nfrom kinto.events import ServerFlushed\n\nflush = Service(name='flush',\n                description='Clear database content',\n                path='/__flush__')\n\n\n@flush.post(permission=NO_PERMISSION_REQUIRED)\ndef flush_post(request):\n    request.registry.storage.flush()\n    request.registry.permission.flush()\n    request.registry.cache.flush()\n    event = ServerFlushed(request)\n    request.registry.notify(event)\n\n    request.response.status = 202\n    return {}\n", "path": "kinto/views/flush.py"}]}