API - Add support for request content in JSON

This commit is contained in:
Josué Tille 2024-07-13 00:06:43 +02:00
parent 497ea8a4af
commit 52f6f48f03
No known key found for this signature in database
GPG key ID: 5F259226AD51F2F5

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import json
import re
import errno
import logging
@ -314,6 +314,10 @@ class _ActionsMapPlugin:
for a in args:
params[a] = True
if request.content_type == "application/json":
# Manage in REST with JSON content mode
params.update(json.loads(list(request.params.dict.keys())[0]))
else:
# Append other request params
req_params = list(request.params.dict.items())
# TODO test special chars in filename