From ab3a76bea9402244965ff29ad3dc5d613fa8ac03 Mon Sep 17 00:00:00 2001 From: chrysn Date: Tue, 4 Aug 2015 15:11:38 +0200 Subject: [PATCH] add content-format to response among other effects, this makes the response readable more easily in copper. --- coapserver.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coapserver.py b/coapserver.py index 2d9674a..c5a923b 100644 --- a/coapserver.py +++ b/coapserver.py @@ -43,7 +43,9 @@ def render_post(self, request): else: return aiocoap.Message(code=aiocoap.NOT_FOUND, payload='Station not found'.encode('ascii')) - return aiocoap.Message(code=aiocoap.CONTENT, payload=payload.encode('UTF-8')) + response = aiocoap.Message(code=aiocoap.CONTENT, payload=payload.encode('UTF-8')) + response.opt.content_format = aiocoap.numbers.media_types_rev['application/json'] + return response def main():