From e9f2d7eb63378f1894035eaa3cefb6ab00f7a7bb Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 29 Feb 2016 09:15:21 -0500 Subject: [PATCH] Improve logout return to browsers A browser may choke on non-JSON if promised JSON. Fix this by passing down JSON for now (API explorer users can deal with seeing JSON for error data) --- confluent_server/confluent/httpapi.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/confluent_server/confluent/httpapi.py b/confluent_server/confluent/httpapi.py index a385d12f..5c015ff6 100644 --- a/confluent_server/confluent/httpapi.py +++ b/confluent_server/confluent/httpapi.py @@ -317,6 +317,7 @@ def resourcehandler_backend(env, start_response): """Function to handle new wsgi requests """ mimetype, extension = _pick_mimetype(env) + headers = [('Content-Type', mimetype), ('Cache-Control', 'no-cache')] reqbody = None reqtype = None if 'CONTENT_LENGTH' in env and int(env['CONTENT_LENGTH']) > 0: @@ -329,8 +330,8 @@ def resourcehandler_backend(env, start_response): del querydict['restexplorerop'] authorized = _authorize_request(env, operation) if 'logout' in authorized: - start_response('200 Sucessful logout', []) - yield('200 - Successful logout') + start_response('200 Sucessful logout', headers) + yield('{"result": "200 - Successful logout"}') return if 'HTTP_SUPPRESSAUTHHEADER' in env: badauth = [('Content-type', 'text/plain')] @@ -347,7 +348,6 @@ def resourcehandler_backend(env, start_response): return if authorized['code'] != 200: raise Exception("Unrecognized code from auth engine") - headers = [('Content-Type', mimetype), ('Cache-Control', 'no-cache')] headers.extend( ("Set-Cookie", m.OutputString()) for m in authorized['cookie'].values())