-
Notifications
You must be signed in to change notification settings - Fork 382
Open
Description
Expected behaviour
I was experiencing some issues authenticating with the Reddit API using this client, so I tried to isolate the problem in a blank C++ file, and I believe it is because the library is sending deformed data to the server.
I have a simple test.cpp
with the following contents:
#include <restclient-cpp/restclient.h>
#include <restclient-cpp/connection.h>
int main () {
RestClient::init();
RestClient::Connection * connection = new RestClient::Connection ("http://localhost:3000");
RestClient::Response response = connection->post("/post", "{\"foo\": \"bar\"}");
delete connection;
RestClient::disable();
}
...and I spun up a simple web server in Express.js that just repeats back what it receives with the following contents:
'use strict';
const PORT = 3000;
const express = require("express");
const app = express();
app.use(express.static('public'));
app.use(express.urlencoded({
extended: true
}));
app.post("/post", (req, res) => {
console.log(req.body)
res.send({})
})
app.listen(PORT, () => {
console.log(`Server listening on port ${PORT}...`);
});
I expected the Express server to print this:
Server listening on port 3000...
{ foo: 'bar' }
...which was generated by sending the following request with Python requests
:
requests.post("http://localhost:3000/post", {"foo": "bar"})
Actual behaviour
Server listening on port 3000...
{ '{"foo": "bar"}': '' }
Environment and debugging details
- compiler and version:
g++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0
- operating system:
Ubuntu 22.04 LTS amd64
- version of restclient-cpp:
master
- how did you install restclient-cpp? (via packages, git, tarball):
git
- libcurl version and compile flags:
libcurl4-openssl-dev/jammy-updates,jammy-security,now 7.81.0-1ubuntu1.3 amd64
(some of these things might not apply but the more you can provide the easier
it will be to fix this bug. Thanks!)
Metadata
Metadata
Assignees
Labels
No labels