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

Error thrown when UserAgent is null #7916

Open
angelofan opened this issue Nov 17, 2024 · 1 comment
Open

Error thrown when UserAgent is null #7916

angelofan opened this issue Nov 17, 2024 · 1 comment

Comments

@angelofan
Copy link

From RFC7231 User-Agent :

A user agent SHOULD send a User-Agent field in each request unless specifically configured not to do so.

From Microsoft Dotnet Api :

The UserAgent is null when there is no User-Agent header in the request.


The header is a web standard, but we can not guarantee that is present. For example if the call is made with cURL, HttpClient, low level component, ...

The code must be "null-safe", it should not generate an exception if UserAgent is null.

@angelofan
Copy link
Author

Although it is possible to avoid passing null in with some pre-judgment, it is easy to forget. For example, every time I use this package for a new project, this problem will occur again when I forget to write some pre-judgment.

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

No branches or pull requests

1 participant