Code Monkey home page Code Monkey logo

docs's People

Contributors

adam-nielsen avatar alebcay avatar alysondeives avatar com8 avatar deontic avatar dependabot[bot] avatar flier avatar fredstober avatar garfield96 avatar hexadec avatar jmhersc avatar jsouquie avatar kingkili avatar kkarbowiak avatar leviliangtw avatar pierrickkoch avatar simon-berger avatar spriteovo avatar tastytea avatar tomaszewskip avatar waltronix avatar whoshuu avatar workingrobot avatar xloem avatar zydxhs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

docs's Issues

How to send data that is not form-encoded?

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} });

Document optimization and connection re-use for multi-threaded applications

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.