Skip to content

Commit 6b368b6

Browse files
committed
correction test main
1 parent 52cbe82 commit 6b368b6

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

test/test_redirects/test_main.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#define private public
66
#include "AsyncHttpClient.h"
7+
#include "CookieJar.h"
78
#include "RedirectHandler.h"
89
#undef private
910

@@ -232,7 +233,7 @@ static void test_cookie_roundtrip_basic() {
232233
TEST_ASSERT_TRUE(client.parseResponseHeaders(ctx, frame));
233234

234235
AsyncHttpRequest follow(HTTP_METHOD_GET, "http://example.com/home");
235-
client.applyCookies(&follow);
236+
client._cookieJar->applyCookies(&follow);
236237
TEST_ASSERT_EQUAL_STRING("session=abc123", follow.getHeader("Cookie").c_str());
237238

238239
cleanupContext(ctx);
@@ -248,15 +249,15 @@ static void test_cookie_path_and_secure_rules() {
248249
TEST_ASSERT_TRUE(client.parseResponseHeaders(ctx, frame));
249250

250251
AsyncHttpRequest wrongPath(HTTP_METHOD_GET, "http://example.com/public");
251-
client.applyCookies(&wrongPath);
252+
client._cookieJar->applyCookies(&wrongPath);
252253
TEST_ASSERT_TRUE(wrongPath.getHeader("Cookie").isEmpty());
253254

254255
AsyncHttpRequest insecureTarget(HTTP_METHOD_GET, "http://example.com/admin/dashboard");
255-
client.applyCookies(&insecureTarget);
256+
client._cookieJar->applyCookies(&insecureTarget);
256257
TEST_ASSERT_TRUE(insecureTarget.getHeader("Cookie").isEmpty());
257258

258259
AsyncHttpRequest secureTarget(HTTP_METHOD_GET, "https://example.com/admin/dashboard");
259-
client.applyCookies(&secureTarget);
260+
client._cookieJar->applyCookies(&secureTarget);
260261
TEST_ASSERT_EQUAL_STRING("admin=1", secureTarget.getHeader("Cookie").c_str());
261262

262263
cleanupContext(ctx);

0 commit comments

Comments
 (0)