在我非常简单的cherrypy 服务器中,我尝试获取请求的POST 数据。我环顾四周并想出了:
class UpdateScript:
def index(self):
cl = cherrypy.request.body.params
print(cl)
return ""
index.exposed = True
但它只打印 {}。我错过了什么?
编辑:我用于发送发布请求的 c# 代码是:
var client = new WebClient();
byte[] response = client.UploadData(UpdateScriptUrl, "POST", System.Text.Encoding.ASCII.GetBytes("field1=value1&field2=value2"));