Actually 500 bad request is shown in the time of Http request method is run
using namespace std;
const wstring domain = L"localhost";
const wstring requestHeader = L"Content-Type: application/json";
int port = 7276;
bool https = true;
using namespace WinHttpWrapper;
HttpRequest req(domain, port, https);
HttpResponse response;
cout << "Action: Create Product with Id = 1" << endl;
req.Post(L"/api/SuperHero/create",
requestHeader,
R"({"id": 4,
"name": "Deepak",
"firstName": "Kumar",
"lastName": "singh",
"place": "Agra"})",
response);
cout << "Returned Status:" << response.statusCode << endl << endl;
response.Reset();
What I have tried:
<using namespace std;
const wstring domain = L"localhost";
const wstring requestHeader = L"Content-Type: application/json";
int port = 7276;
bool https = true;
using namespace WinHttpWrapper;
HttpRequest req(domain, port, https);
HttpResponse response;
cout << "Action: Create Product with Id = 1" << endl;
req.Post(L"/api/SuperHero/create",
requestHeader,
R"({""id": 4,
"name": "Deepak",
"firstName": "Kumar",
"lastName": "singh",
"place": "Agra"})",
response);
cout << "Returned Status:" << response.statusCode << endl << endl;
response.Reset();