File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1+ import json
12import os
23from multiprocessing import Process
34from typing import Dict , List , Tuple , TypedDict
45
56from flask import Flask , jsonify , request # type: ignore
6-
77from servc .svc import ComponentType , Middleware
88from servc .svc .client .send import sendMessage
99from servc .svc .com .bus import BusComponent
@@ -119,11 +119,14 @@ def _getResponse(self, id: str):
119119 def _postMessage (self , extra_params : Dict | None = None ):
120120 if not extra_params :
121121 extra_params = {}
122- content_type = request .headers .get ("Content-Type" , None )
122+ content_type = request .headers .get ("Content-Type" , "" )
123123 if request .method == "GET" :
124124 return self ._getInformation ()
125- if content_type == "application/json" :
126- body = request .json
125+ if content_type == "application/json" or "multipart/form-data" in content_type :
126+ if "multipart/form-data" in content_type :
127+ body = json .loads (request .form ["json" ])
128+ else :
129+ body = request .json
127130 if not body :
128131 return "bad request" , StatusCode .INVALID_INPUTS .value
129132
You can’t perform that action at this time.
0 commit comments