Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Discord integration #531

Merged
merged 3 commits into from Nov 16, 2021
Merged

Fix Discord integration #531

merged 3 commits into from Nov 16, 2021

Conversation

brianpeiris
Copy link
Contributor

@brianpeiris brianpeiris commented Nov 16, 2021

In #452 we added a browser user-agent header to all requests made through all the functions in our HttpUtils module. That change is now breaking Discord integration, since it seems Discord now rejects API requests that include a user-agent header.

This PR removes the user-agent header from all requests by default, unless it is enabled with the new append_browser_user_agent parameter. Incidentally, the functions in HttpUtils have also been changed to use a keyword-list for their optional parameters, to avoid having to worry about positional arguments.

As far as I can tell, only the screenshot and opengraph code paths require a user-agent header enabled, so I've had all the other calls omit the header by default.

Copy link
Contributor

@johnshaughnessy johnshaughnessy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I did not run this code to verify that there aren't new regressions where some of the other requests needed the user agent header.

lib/ret/http_utils.ex Outdated Show resolved Hide resolved
lib/ret/http_utils.ex Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants