Skip to content

Commit 19311eb

Browse files
authored
Merge pull request #35 from ardalann/master
Fixed infinite redirects when trying to GET an Instagram profile
2 parents 4735830 + e00f4aa commit 19311eb

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

src/core/proxy.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ const requestHandler = async (request, proxy, overrides = {}) => {
1919
agent: setAgent(proxy),
2020
responseType: "buffer",
2121
maxRedirects: 15,
22-
throwHttpErrors: false
22+
throwHttpErrors: false,
23+
ignoreInvalidCookies: true,
24+
followRedirect: false
2325
};
2426
try {
2527
const response = await got(overrides.url || request.url(), options);
@@ -35,7 +37,9 @@ const requestHandler = async (request, proxy, overrides = {}) => {
3537
headers: response.headers,
3638
body: response.body
3739
});
38-
} catch(error) {await request.abort()}
40+
} catch (error) {
41+
await request.abort();
42+
}
3943
};
4044

4145
// For reassigning proxy of page
@@ -91,4 +95,4 @@ const useProxy = async (target, data) => {
9195
}
9296
};
9397

94-
module.exports = useProxy;
98+
module.exports = useProxy;

0 commit comments

Comments
 (0)