I'm using the following code: (not showing checks and debug info)
WiFiClient client;
client.connect("172.16.1.4", 5984);
String connStr = "POST /iot/ HTTP/1.1\r\n"
"Host: user:password@172.16.1.4:5984/ \r\n"
"Content-Type: application/json\r\n"
"\r\n"
"'{\"a\":1}'\r\n\r\n";
client.print(connStr);
This is what I get back:
HTTP/1.1 400 Bad Request
Server: CouchDB/1.6.1 (Erlang OTP/18)
Date: Sat, 07 Oct 2017 11:57:50 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 48
Cache-Control: must-revalidate
{"error":"bad_request","reason":"invalid_json"}
HTTP/1.1 400 Bad Request
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Sat, 07 Oct 2017 11:57:50 GMT
Content-Length: 0
I have tried with different json/data
Using linux works fine:
curl -X POST user:password@172.16.1.4:5984/iot/ -H "Content-Type: application/json" -d '{"a":1}'
Lars Bo Wassini