How to get parameter from "post request"

Hi everyone! I run into a question, the detail is following:

<form action='/test2' method='post' name='f1'>
<input type='hidden' name='A' value='1'/>
<input type='submit value='TEST'/>
</form>
app = Sanic('test')
def test1(request):
    form = reuest.form

app.add_route(test1, 'test1', method=['GET','POST'])
app.run()

============================================
Question:

while i click the ‘button’, the form will submit, all is normal, strangely, i did not get value of parameter ‘A’ from post request on sanic 21.3.2, However, when I develop same code and run it on 20.12.3, i can get value of parameter ‘A’.

So. who can get me a reasonable solution about how to develop my code, thanks for all!!!

There is a known issue that happens in certain circumstances depending upon the routes that are defined.

You can likely solve it (make sure you are on 0.5.2 of sanic-routing) by manually telling Sanic to parse the body:

def test1(request):
    await request.receive_body()

There is a pending PR that will hopefully be released soon that will resolve this: