Send GNS 3 server version in header and upgrade aiohttp

This commit is contained in:
Julien Duponchelle committed 2015-01-26 14:40:31 +01:00
1 parent df8bdcc152
commit 9abf323e7d
2 files changed
+5 -1

No files matched your search

+4
View File
@@ -19,6 +19,8 @@ import json
import jsonschema
import aiohttp.web
import logging
import sys
from ..version import __version__
log = logging.getLogger(__name__)
@@ -30,6 +32,7 @@ class Response(aiohttp.web.Response):
self._route = route
self._output_schema = output_schema
headers['X-Route'] = self._route
headers['Server'] = "Python/{0[0]}.{0[1]} GNS3/{1}".format(sys.version_info, __version__)
super().__init__(headers=headers, **kwargs)
"""
@@ -42,6 +45,7 @@ class Response(aiohttp.web.Response):
def json(self, answer):
"""Pass a Python object and return a JSON as answer"""
print(self.headers)
self.content_type = "application/json"
if hasattr(answer, '__json__'):
answer = answer.__json__()