Browse Source

添加接口类实现描述。

jianfeng1.wang 2 years ago
parent
commit
56ce1f7682
1 changed files with 20 additions and 6 deletions
  1. 20 6
      WINHTTPS/WINHTTPS/WINHTTPS.cpp

+ 20 - 6
WINHTTPS/WINHTTPS/WINHTTPS.cpp

@@ -6,6 +6,18 @@
 #include "HTTPHelper.h"
 
 
+/*
+接口类的步骤:
+1、设置请求行
+	1.1、设置请求方式: GET/POST/...;
+	1.2、设置请求url(访问资源);
+	1.3、设置HTTP协议版本(HTTP/1.1)
+2、设置请求头;
+3、设置请求数据;
+4、发送请求;
+5、结果处理;
+*/
+
 void test_get()
 {
 	HTTPRESULT result;
@@ -74,8 +86,8 @@ void test_getkey()
 	HTTPRESULT res;
 	HTTPHelper http;
 	http.SetMethod(L"POST");
-	http.SetUrl(L"http://test.idmanage.qhmoka.com/IDManage/v2/bind/order");
-	http.AddBodyRawData("{\"orderNum\":\"TEST_WJF\",\"sn\":\"SN0321-test9999\",\"psn\":\"20220321APSN9999\",\"orderCode\":\"BBB\",\"skipKey\": []}", L"application/json;charset=utf8");
+	http.SetUrl(L"https://test.idmanage.qhmoka.com/IDManage/v2/bind/order");
+	http.AddBodyRawData("{\"orderNum\":\"TR_TEST_MI_2\",\"sn\":\"AA-BB-CC-DD-EE-22\",\"psn\":\"\",\"orderCode\":\"\",\"skipKey\": []}", L"application/json;charset=utf8");
 	http.GetHtml(res);
 
 	wprintf(L"ResponseHeader=%s\r\n",res.m_strHeader.c_str());
@@ -183,11 +195,13 @@ void test_getmssage()
 
 void test()
 {
-	test_login();
-	test_updateCheck();
-	test_getmssage();
-	test_getmessageV2();
+	//test_login();
+	//test_updateCheck();
+	//test_getmssage();
+	//test_getmessageV2();
 	test_getkey();
+
+	system("pause");
 }
 
 int _tmain(int argc, _TCHAR* argv[])