Skip to content

Commit 802f8f7

Browse files
Fix 403 forbidden errors
1 parent 6004209 commit 802f8f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ export class Client {
9292
* @returns - The Screenshot class
9393
*/
9494
async screenshot(url: string): Promise<Screenshot | null> {
95-
if (!/https?:\/\//g.test(url)) url = `http://${url}`;
95+
if (!/https:\/\//g.test(url))
96+
url = `https://${/http:\/\//g.test(url) ? `${url.slice(7)}` : url}`;
9697
const screenshot: EndpointResponse | null = await this.rest.get(
9798
`/screenshot?url=${encodeURI(url)}`
9899
);

0 commit comments

Comments
 (0)