Comments (10)
抓包看看二者哪里不同。
from cinatra.
py requests 传过去多了一个头信息,但是我其他的接口用这两种访问方式就没有这样的问题
from cinatra.
用node js传呢
from cinatra.
没用过node.js,主要最近用你推荐的file方式上传图片,写好整个项目,但是今天利用python调用接口发现py request上传的图片req.get_upload_files()获取不到
from cinatra.
你打包一个上传文件的测试程序给我,我看看。
from cinatra.
我用postman就可以正常上传图片,问题就是我最开始截图的那两个问题
from cinatra.
void process(request& req, response& res) {
auto& files = req.get_upload_files();
std::string img_path;
for (auto& file : files) {
std::cout << file.get_file_path() << " " << file.get_file_size() << std::endl;
img_path = file.get_file_path();
}
auto data = req.body();
std::cout << "body length:" << data<< std::endl;
}
from cinatra.
import base64
import requests
from urllib.parse import unquote
with open("../data/img/test1.png", "rb") as f:
img = f.read()
headers = {"Content-Type": "form-data"}
req_url = "http://127.0.0.1:8081/"
res = requests.post(req_url, headers=headers, files={"file": img})
print(res.text)
py 的测试程序
from cinatra.
要不我加你qq,截图给你看也行
from cinatra.
你加cinatra qq群吧 340713904
from cinatra.
Related Issues (20)
- refactor cinatra server to support c++20 coroutine HOT 4
- 编译报错,‘_M_set_length’ is not a member of ‘std::string’ HOT 5
- 如何使用已有的io_context运行cinatra HOT 1
- 如何获取coro_http_client调接口 耗时 HOT 3
- Highly concurrent downloading of 2m js files will increase memory usage HOT 1
- websocket,1分钟没有消息交互,服务端会主动把链接掐断 HOT 2
- Windows visit Chinese filename not found
- 请问下,考虑支持unix套接字吗. HOT 10
- 是否可以让server对象的listen函数支持设置连接队列的长度? HOT 6
- bug: gcc resize_and_overwrite 導致髒數據的問題 HOT 21
- fatal error: 'asio/dispatch.hpp' file not found HOT 2
- https question HOT 18
- Failed to connect websocket with `Connection: upgrade` HOT 3
- [需求] 处理程序相关 HOT 12
- client URL 检测 的奇怪 bug HOT 7
- 上传二进制文件无法使用 HOT 2
- async_download 没有写入内容到文件 HOT 5
- 请问下,当链接断开时,如何获取到具体原因? HOT 3
- 【错误与需求】Nginx与chunked模式 HOT 16
- Access-Control-Allow-Origin
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cinatra.