For example, I have this code:
import vibe.core.log;
import vibe.http.client;
import vibe.stream.operations;
void test()
{
requestHTTP(`http://username:password@127.0.0.1:1234",
(scope req) {
req.method = HTTPMethod.POST;
req.writeJsonBody(["name": "My Name"]);
},
(scope res) {
logInfo("Response: %s", res.bodyReader.readAllUTF8());
}
);
}
It doesn't work, I have the error 401 Unauthorized.
. Note that the same code works fine via std.net.curl
.
Am I miss something, or Vibe.d's vibe.http.client.requestHTTP
haven't got support of authorised requests?