add DEBUG switch and fix win build error

This commit is contained in:
zhangzifa
2019-02-21 11:20:28 +08:00
committed by TonyZZF
parent 6a5f788210
commit eb7ab33440
7 changed files with 65 additions and 13 deletions

View File

@@ -23,9 +23,11 @@ int main(int argc, char** argv) {
request.setDomain("nlp.cn-shanghai.aliyuncs.com");
request.setResourcePath("/nlp/api/wordsegment/general");
request.setHttpMethod(HttpRequest::Post);
const char * data = "{\"lang\":\"ZH\",\"text\":\"Iphone is a bad choice 专用数据线\"}";
request.setContent(data, strlen(data));
// if windows, Chinese character will result in build error.
const std::string data = "{\"lang\":\"ZH\",\"text\":\"Iphone is a good choice.\"}";
request.setContent(data.c_str(), data.size());
request.setHeaderParameter("Content-Type", "application/json;chrset=utf-8");
request.setHeaderParameter("Accept", "application/json");
request.setVersion("2018-04-08");