mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-30 21:03:49 +02:00
Fix /settings
This commit is contained in:
parent
0f7037bb32
commit
814fd1fcfb
@ -35,11 +35,11 @@ from ..config import Config
|
|||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def parse_request(request, input_schema):
|
def parse_request(request, input_schema, raw):
|
||||||
"""Parse body of request and raise HTTP errors in case of problems"""
|
"""Parse body of request and raise HTTP errors in case of problems"""
|
||||||
|
|
||||||
content_length = request.content_length
|
content_length = request.content_length
|
||||||
if content_length is not None and content_length > 0 and input_schema:
|
if content_length is not None and content_length > 0 and not raw:
|
||||||
body = yield from request.read()
|
body = yield from request.read()
|
||||||
try:
|
try:
|
||||||
request.json = json.loads(body.decode('utf-8'))
|
request.json = json.loads(body.decode('utf-8'))
|
||||||
@ -176,7 +176,7 @@ class Route(object):
|
|||||||
if api_version is None or raw is True:
|
if api_version is None or raw is True:
|
||||||
response = Response(request=request, route=route, output_schema=output_schema)
|
response = Response(request=request, route=route, output_schema=output_schema)
|
||||||
|
|
||||||
request = yield from parse_request(request, None)
|
request = yield from parse_request(request, None, raw)
|
||||||
yield from func(request, response)
|
yield from func(request, response)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ class Route(object):
|
|||||||
if "controller" in func.__module__ and server_config.getboolean("controller", False) is False:
|
if "controller" in func.__module__ and server_config.getboolean("controller", False) is False:
|
||||||
raise aiohttp.web.HTTPForbidden(text="The server is not a controller")
|
raise aiohttp.web.HTTPForbidden(text="The server is not a controller")
|
||||||
|
|
||||||
request = yield from parse_request(request, input_schema)
|
request = yield from parse_request(request, input_schema, raw)
|
||||||
record_file = server_config.get("record")
|
record_file = server_config.get("record")
|
||||||
if record_file:
|
if record_file:
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user