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: 937 - removed home-made user agent header when for web #950

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

monsieurtanuki
Copy link
Contributor

What

  • Our home-made user agent prevents our dart package to work when used in web mode.
  • We use this specific user agent for stats.
  • The solution implemented here removes the user agent http header when in web mode, so that the package can be used.
  • Possible improvements would be to change the way we build our user agent string (but that would have an impact on our previous/next stats), or where we put that home-made string (e.g. different http header tag) (but that would have an impact on our stats consistency too)
  • We'll see how many requests we get from web mode. Later we can select one of the suggested improvements, or something else.

Fixes bug(s)

Impacted files

  • api_add_product_image_test.dart: minor refactoring
  • http_helper.dart: removed home-made user agent header when for web; minor refactoring
  • open_prices_api_client.dart: minor refactoring
  • uri_reader.dart: added an isWeb getter; minor refactoring
  • uri_reader_js.dart: implemented the isWeb getter

Impacted files:
* `api_add_product_image_test.dart`: minor refactoring
* `http_helper.dart`: removed home-made user agent header when for web; minor refactoring
* `open_prices_api_client.dart`: minor refactoring
* `uri_reader.dart`: added an `isWeb` getter; minor refactoring
* `uri_reader_js.dart`: implemented the `isWeb` getter
@monsieurtanuki monsieurtanuki requested a review from a team as a code owner July 8, 2024 09:43
@monsieurtanuki monsieurtanuki requested a review from M123-dev July 8, 2024 09:45
Copy link
Contributor

@g123k g123k left a comment

Choose a reason for hiding this comment

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

Thanks for the change.
We were getting more and more complaints about this.

@monsieurtanuki monsieurtanuki merged commit b7da12b into openfoodfacts:master Jul 19, 2024
4 of 5 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you @g123k for your review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Flutter Web and the User Agent
3 participants