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 ac42f91
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/disableRedirect.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import initCycleTLS from "../dist/index.js";
jest.setTimeout(30000);

let ja3 =
"771,4865-4867-4866-49195-49199-52393-52392-49196-49200-49162-49161-49171-49172-51-57-47-53-10,0-23-65281-10-11-35-16-5-51-43-13-45-28-21,29-23-24-25-256-257,0";
Expand Down Expand Up @@ -35,3 +36,36 @@ test("Should return a 301 redirect", async () => {

cycleTLS.exit();
});

test("Should return final url a 301 redirect", async () => {
const cycleTLS = await initCycleTLS({ port: 9114 });
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)

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();
});
2 changes: 2 additions & 0 deletions tests/tls13.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import initCycleTLS from "../dist/index.js";
jest.setTimeout(10000);

test("Should return a 200 response from tls 1.3", async () => {
const cycleTLS = await initCycleTLS({ port: 9111 });
Expand All @@ -14,6 +15,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 ac42f91

Please sign in to comment.