Closed jczic closed 4 years ago
About this question, there is actually no method to handle the end of the response sent... I can add an event property in few time. You'll be able to have a method to handle this with or without a keep-alive context.
Alright. and also if I call any method from a handler it won't show any response in the browser.
@webroute(POST, '/test-post', name='TestPost2/2') def RequestTestPost(microWebSrv2, request) : data = request.GetPostedURLEncodedForm() try :
first = data['Firstname']
last = data['Lastname']
f = open('data.txt','w')
f.write(first+'\n')
f.write(last)
f.close()
#**********************************Calling a method***********************
someMethod()
except : request.Response.ReturnBadRequest() return content = """\ <!DOCTYPE html>
""" request.Response.ReturnOk(content)
That's depend of methods... You are in a thread during the process of the request.
Ok @aqieez, you can set an event property to handle the response sent 👍 See https://github.com/jczic/MicroWebSrv2#response-prop (OnSent)
But I have another question... Please
@WebRoute(POST, '/test-post', name='TestPost2/2') def RequestTestPost(microWebSrv2, request) : data = request.GetPostedURLEncodedForm() try :
After saving the first name and last name to a file. I want to return a response and then I want to reboot the microcontroller. but It is only rebooting the but not showing the response in the browser.
Originally posted by @aqieez in https://github.com/jczic/MicroWebSrv2/issues/10#issuecomment-558077044