在 Android 手机上,我使用 setEntity() 将 FileEntity 放入 POST 请求。
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)。