Commit 554f6962 authored by Yury's avatar Yury

add 'application/dns-message' response content type

parent fca772f1
Pipeline #109 canceled with stages
in 6 minutes and 16 seconds
......@@ -20,16 +20,16 @@ class Protocol:
query = request.rel_url.query['dns']
decoded_query = base64.b64decode(query + '=' * (4 - len(query) % 4))
result = await dispatcher.handle(decoded_query)
return web.Response(text=base64.b64encode(result).decode('ascii'))
return web.Response(text=base64.b64encode(result).decode('ascii'), content_type='application/dns-message')
elif request.method == 'POST':
data = await request.json(loads=json.loads)
query = data['dns']
decoded_query = base64.b64decode(query + '=' * (4 - len(query) % 4))
result = await dispatcher.handle(decoded_query)
return web.Response(text=base64.b64encode(result).decode('ascii'))
return web.Response(text=base64.b64encode(result).decode('ascii'), content_type='application/dns-message')
except KeyError:
return web.Response(text='Error')
return web.Response(text='')
return web.Response(text='Error', content_type='application/dns-message')
return web.Response(text='', content_type='application/dns-message')
async def start(self):
await web._run_app(self.app, port=self.connector.port, host=self.connector.host)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment