remove trailing space in cpprest, update samples

This commit is contained in:
wing328
2017-04-24 22:45:16 +08:00
parent fc2b3d49ea
commit aa85468932
32 changed files with 217 additions and 139 deletions

View File

@@ -1,9 +1,9 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@wordnik.com
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -56,6 +56,11 @@ utility::string_t ApiClient::parameterToString(int32_t value)
return utility::conversions::to_string_t(valueAsStringStream.str());
}
utility::string_t ApiClient::parameterToString(float value)
{
return utility::conversions::to_string_t(std::to_string(value));
}
utility::string_t ApiClient::parameterToString(const utility::datetime &value)
{
return utility::conversions::to_string_t(value.to_string(utility::datetime::ISO_8601));
@@ -124,12 +129,24 @@ pplx::task<web::http::http_response> ApiClient::callApi(
}
else
{
web::http::uri_builder formData;
for (auto& kvp : formParams)
if (contentType == U("application/json"))
{
formData.append_query(kvp.first, kvp.second);
web::json::value body_data = web::json::value::object();
for (auto& kvp : formParams)
{
body_data[U(kvp.first)] = ModelBase::toJson(kvp.second);
}
request.set_body(body_data);
}
else
{
web::http::uri_builder formData;
for (auto& kvp : formParams)
{
formData.append_query(kvp.first, kvp.second);
}
request.set_body(formData.query(), U("application/x-www-form-urlencoded"));
}
request.set_body(formData.query(), U("application/x-www-form-urlencoded"));
}
}