From 8528526f0b6dc8828247ef03f11e4894580f8dd5 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Tue, 13 Sep 2011 19:24:48 +0200 Subject: [PATCH] API: set the mimetype on the response --- budget/api.py | 2 ++ budget/rest.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/budget/api.py b/budget/api.py index c50d668..ddaf65c 100644 --- a/budget/api.py +++ b/budget/api.py @@ -64,6 +64,8 @@ class MemberHandler(object): def delete(self, project, member_id): if project.remove_member(member_id): return Response('OK', status=200) + else: + return Response('Not Found', status=404) class BillHandler(object): diff --git a/budget/rest.py b/budget/rest.py index e698e21..8ade14b 100644 --- a/budget/rest.py +++ b/budget/rest.py @@ -133,7 +133,8 @@ def serialize(func): return data else: # serialize it - return SERIALIZERS.get(mime, "text/json").encode(data) + return werkzeug.Response(SERIALIZERS[mime].encode(data), + status=200, mimetype=mime) return wrapped