2
在Android手机上,我使用setEntity()将FileEntity置于POST请求。使用Python瓶服务器接收来自Android的POST请求的FileEntity
HttpPost post = new HttpPost(uri);
FileEntity reqEntity = new FileEntity(f, "application/x-gzip");
reqEntity.setContentType("binary/octet-stream");
reqEntity.setChunked(true);
post.addHeader("X-AethersNotebook-Custom", configuration.getCustomHeader());
post.setEntity(reqEntity);
当使用瓶,试过,但它不工作
f = request.body
gzipper = gzip.GzipFile(fileobj= f)
content = gzipper.read()
的内容将是一个空字符串。所以我试图看看request.forms和request.files。他们都没有关键和价值。
request.files.keys()
request.forms.keys()
查询时,我看了一下实体:“一个请求可以传送实体”,实体有实体头和实体值。所以它可能像file-content = e.get(entity-header)。
在Bottle中,'request.body'包含原始未解析的请求主体。如果它是空的,那么没有数据被发送到服务器。我会在客户端搜索错误。 – defnull