Skip to content

Commit

Permalink
Merge pull request #35 from ardalann/master
Browse files Browse the repository at this point in the history
Fixed infinite redirects when trying to GET an Instagram profile
  • Loading branch information
Cuadrix authored Jul 21, 2020
2 parents 4735830 + e00f4aa commit 19311eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
10 changes: 7 additions & 3 deletions src/core/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ const requestHandler = async (request, proxy, overrides = {}) => {
agent: setAgent(proxy),
responseType: "buffer",
maxRedirects: 15,
throwHttpErrors: false
throwHttpErrors: false,
ignoreInvalidCookies: true,
followRedirect: false
};
try {
const response = await got(overrides.url || request.url(), options);
Expand All @@ -35,7 +37,9 @@ const requestHandler = async (request, proxy, overrides = {}) => {
headers: response.headers,
body: response.body
});
} catch(error) {await request.abort()}
} catch (error) {
await request.abort();
}
};

// For reassigning proxy of page
Expand Down Expand Up @@ -91,4 +95,4 @@ const useProxy = async (target, data) => {
}
};

module.exports = useProxy;
module.exports = useProxy;

0 comments on commit 19311eb

Please sign in to comment.