Skip to content

Commit 19c2e40

Browse files
Merge pull request #42 from Countly/sdk-621
[SDK 621] Windows POST Request issue fixed
2 parents 628b545 + 7d6db25 commit 19c2e40

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* ! Minor breaking change ! Default automatic session update duration changed to 60 seconds.
44
* Added a call to change the automatic session update duration.
55
* Fixed a bug where session duration was reported wrong.
6+
* Fixed a bug that caused POST requests to fail on Windows.
67

78
21.11.0
89
* Fixed session duration issue.

src/countly.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,8 @@ log(Countly::LogLevel::DEBUG, "[Countly][sendHTTP] data: "+ data);
703703
}
704704

705705
if (hRequest) {
706-
bool ok = WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, use_post ? (LPVOID)data.data() : WINHTTP_NO_REQUEST_DATA, use_post ? data.size() : 0, 0, 0) != 0;
706+
LPCWSTR headers = use_post ? L"content-type:application/x-www-form-urlencoded" : WINHTTP_NO_ADDITIONAL_HEADERS;
707+
bool ok = WinHttpSendRequest(hRequest, headers, 0, use_post ? (LPVOID)data.data() : WINHTTP_NO_REQUEST_DATA, use_post ? data.size() : 0, use_post ? data.size() : 0, 0) != 0;
707708
if (ok) {
708709
ok = WinHttpReceiveResponse(hRequest, NULL);
709710
if (ok) {

0 commit comments

Comments
 (0)