Closed lswjkllc closed 3 years ago
I am assuming you got this working fine?
from sanic import Sanic
from sanic.log import logger
from sanic.response import text
app = Sanic("__BASE__")
@app.post("/")
async def get1(request):
logger.info(f"excel_input request body: { request.body }")
input_param = request.form
logger.info(f"excel input form data: { input_param }")
return text("Done.")
if __name__ == "__main__":
app.run(access_log=False, debug=True, port=9999)
[2020-12-24 19:57:31 +0200] [100744] [INFO] Goin' Fast @ http://127.0.0.1:9999
[2020-12-24 19:57:31 +0200] [100744] [INFO] Starting worker [100744]
[2020-12-24 19:57:33 +0200] [100744] [INFO] excel_input request body: b'--X-INSOMNIA-BOUNDARY\r\nContent-Disposition: form-data; name="name"\r\n\r\nadam\r\n--X-INSOMNIA-BOUNDARY\r\nContent-Disposition: form-data; name="foo"\r\n\r\nbar\r\n--X-INSOMNIA-BOUNDARY\r\nContent-Disposition: form-data; name="fizz"\r\n\r\nbuzz\r\n--X-INSOMNIA-BOUNDARY--\r\n'
[2020-12-24 19:57:33 +0200] [100744] [INFO] excel input form data: {'name': ['adam'], 'foo': ['bar'], 'fizz': ['buzz']}
[2020-12-24 19:57:38 +0200] [100744] [DEBUG] KeepAlive Timeout. Closing connection.
Describe the bug By viewing the log, request body can look three fields("name","data_set_tyep","info") in handler function, but, when I get request data by
request.form
, just get two fields data("data_set_tyep","info")Code snippet
Expected behavior ...
Environment (please complete the following information):
Additional context ...