Skip to content

Commit

Permalink
add test disableRedirect.test.ts on the JS side;
Browse files Browse the repository at this point in the history
  • Loading branch information
Kadi Gasanguseynov committed Nov 22, 2023
1 parent d362163 commit 25939a4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/disableRedirect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ test("Should return a 301 redirect", async () => {
"get"
);
expect(redirectResponse.status).toBe(301);
await cycleTLS.exit();
});

test("Should return a 200 redirect", async () => {
const cycleTLS = await initCycleTLS({ port: 9121 });

const normalResponse = await cycleTLS(
"https://google.com",
Expand All @@ -35,3 +40,43 @@ test("Should return a 301 redirect", async () => {

cycleTLS.exit();
});

test("Should return final url a 301 redirect", async () => {
const cycleTLS = await initCycleTLS({ port: 9122 });
const url = "https://rb.gy/3hwz5h";
const redirectResponse = await cycleTLS(
url,
{
body: "",
ja3: ja3,
userAgent: userAgent,
disableRedirect: true,
},
"get"
);
expect(redirectResponse.status).toBe(301);
expect(redirectResponse.finalUrl).toBe(url)

cycleTLS.exit();
});

test("Should return final url a 200 redirect", async () => {
const cycleTLS = await initCycleTLS({ port: 9124 });
const url = "https://rb.gy/3hwz5h";

const normalResponse = await cycleTLS(
url,
{
body: "",
ja3: ja3,
userAgent: userAgent,
disableRedirect: false,
},
"get"
);

expect(normalResponse.status).toBe(200);
expect(normalResponse.finalUrl).toBe("https://www.google.com/");

cycleTLS.exit();
});
1 change: 1 addition & 0 deletions tests/tls13.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ test("Should return a 200 response from tls 1.3", async () => {
body: "",
ja3: ja3,
userAgent: userAgent,
insecureSkipVerify: true,
},
"get"
);
Expand Down

0 comments on commit 25939a4

Please sign in to comment.