sayem314 / hooman

http interceptor to hoomanize cloudflare requests

Home Page:https://www.npmjs.com/package/hooman

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A suggestion

EloB opened this issue · comments

Hello mate!

I saw this line:

const baseUrl = response.url.substring(0, response.url.lastIndexOf('/'));

Isn't better to use URL? I'm having a problem that it adds pathname twice after each other that fails my request. Like /my/pathname/mypathname instead of /my/pathname. I'm not sure this is the right way to do it or if it's a different puzzle...

const { URL } = require('url');

const { origin: baseUrl } = new URL(response.url);

Best regards!

I also want to say you made an awesome library ❤️

Can you provide an example URL you are having issue with?

I have a PR for this, with an example URL: #25