From d86722c3cb0ce1599785d4ab19a33443dac4d0ee Mon Sep 17 00:00:00 2001 From: David Bailey Date: Sun, 20 Aug 2017 22:29:52 +0100 Subject: [PATCH] Separate standard headers from extra headers --- AnkiConnect.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/AnkiConnect.py b/AnkiConnect.py index ac1cfff..c8b3c2b 100644 --- a/AnkiConnect.py +++ b/AnkiConnect.py @@ -203,19 +203,20 @@ class AjaxServer: def setHeader(self, name, value): - self.headers[name] = value + self.extraHeaders[name] = value def resetHeaders(self): - self.headers = { - 'HTTP/1.1 200 OK': None, - 'Content-Type': 'text/json' - } + self.headers = [ + ['HTTP/1.1 200 OK', None], + ['Content-Type', 'text/json'] + ] + self.extraHeaders = {} def getHeaders(self): - headers = [] - for name in self.headers: + headers = self.headers + for name in self.extraHeaders: headers.append([name, self.headers[name]]) return headers