libcpr / docs Goto Github PK
View Code? Open in Web Editor NEWGitHub Pages repo containing documentation for cpr.
Home Page: https://libcpr.github.io/docs/
GitHub Pages repo containing documentation for cpr.
Home Page: https://libcpr.github.io/docs/
How to view the latest version of the documentation?
It seems that the gh-pages branch is displayed.
I don't see the following commit 69dc7eb at: https://docs.libcpr.org/introduction.html#post-requests
When I send a post request using libcpr or Python's requests, the server returns:
{'msg':'illegal request method','returnCode':'00405','data':'Content type'application/x-www-form-urlencoded; charset=UTF-8'not supported'}'.
C++ Code:
cpr::Response r = cpr::Post(cpr::Url{ "https://ec.95306.cn/api/bl/queryProduct/querySkb" },
cpr::Timeout{ 7000 },
cpr::Payload{ {"gbcc", "X8003"} });
Python Code:
data = {
"gbcc": "X8003"
}
r = requests.post("https://ec.95306.cn/api/bl/queryProduct/querySkb", data=data)
It is written in the docs of Python's requests that:
There are times that you may want to send data that is not form-encoded. If you pass in a string instead of a dict, that data will be posted directly.
andInstead of encoding the dict yourself, you can also pass it directly using the json parameter (added in version 2.4.2) and it will be encoded automatically
.
So I use:
data = {
"gbcc": "X8003"
}
r = requests.post("https://ec.95306.cn/api/bl/queryProduct/querySkb", json=data)
In this way, it works normally.
So how do you use libcurl to do this?
Another problem is how to pass a numeric value with payload, like this:
cpr::Payload{ {"skbbbh",1} });
I'm using the Session object to re-use connections for multiple requests, but what if I also have some requests that are sent by different threads? Session object is not thread-safe, so how am I supposed to optimize connection re-use when having multiple threads?
In general, it would be very useful to have a doc section on how the library API is supposed to be used for a multi-threaded application, and how to optimize and re-use connections in such scenario.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.