Skip to content

Commit

Permalink
Add User-Agent to http request headers
Browse files Browse the repository at this point in the history
Reddit blocks requests without a set User-Agent. All http requests are
now sent with a "Mozilla/5.0" User-Agent header.
  • Loading branch information
ifl0w committed May 1, 2023
1 parent 9bf4e50 commit 58c3270
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/soupBowl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ class SoupBowl {
}

newGetMessage(uri: string) {
return Soup.Message.new('GET', uri);
const message = Soup.Message.new('GET', uri);
// set User-Agent to appear more like a standard browser
message.request_headers.append('User-Agent', 'Mozilla/5.0');
return message;
}

// Possibly wrong version here causing ignores to type checks
Expand Down

0 comments on commit 58c3270

Please sign in to comment.