-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
000594c
commit 46fc70e
Showing
7 changed files
with
82 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import initCycleTLS, { CycleTLSClient } from "../dist/index.js"; | ||
|
||
describe("CycleTLS HTTP Version Tests", () => { | ||
let cycleTLS: CycleTLSClient; | ||
let ja3 = "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,0-23-65281-10-11-35-16-5-13-18-51-45-43-27-21,29-23-24,0"; | ||
let userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36"; | ||
|
||
beforeAll(async () => { | ||
cycleTLS = await initCycleTLS({ port: 9134 }); | ||
}); | ||
|
||
afterAll(() => { | ||
cycleTLS.exit(); | ||
}); | ||
|
||
test("Should use HTTP/2 by default", async () => { | ||
const response = await cycleTLS( | ||
"https://tls.peet.ws/api/all", | ||
{ | ||
body: "", | ||
ja3: ja3, | ||
userAgent: userAgent, | ||
forceHTTP1: false, | ||
}, | ||
"get" | ||
); | ||
|
||
expect(response.status).toBe(200); | ||
let fullResp = response.body as { http_version: string }; | ||
expect(fullResp.http_version).toBe("h2"); | ||
}); | ||
|
||
test("Should force HTTP/1.1 when specified", async () => { | ||
const response = await cycleTLS( | ||
"https://tls.peet.ws/api/all", | ||
{ | ||
body: "", | ||
ja3: ja3, | ||
userAgent: userAgent, | ||
forceHTTP1: true, | ||
}, | ||
"get" | ||
); | ||
|
||
expect(response.status).toBe(200); | ||
let fullResp = response.body as { http_version: string }; | ||
expect(fullResp.http_version).toBe("HTTP/1.1"); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.