improve CommonClient.buildRpcHttpRequest

Supported set body of request.
This commit is contained in:
wb-hx510875
2020-03-23 14:03:11 +08:00
committed by Jackson Tian
parent 9b0cec3ab7
commit 9e1e045351
2 changed files with 32 additions and 2 deletions

View File

@@ -159,6 +159,22 @@ namespace {
ShutdownSdk();
}
TEST(CommonClient, bodyParam) {
const ClientConfiguration cfg;
std::string key = "accessKeyId";
std::string secret = "accessSecret";
std::string token = "sessionToken";
const Credentials credentials(key, secret, token);
CommonRequest cr;
cr.setBodyParameter("TestBodyParamKey", "TestBodyParamValue");
TestCommonClient* client = new TestCommonClient(credentials, cfg);
HttpRequest r = client->buildRpcHttpRequest("cn-hangzhou", cr, HttpRequest::Method::Post);
const char *s = "TestBodyParamKey=TestBodyParamValue";
EXPECT_EQ(*r.body(), *s);
}
TEST(CommonClient, abnormal) {
InitializeSdk();