Document ProductInfoHeaderValue constructors #3274
Labels
area-System.Net
doc-enhancement
Improve the current content
help wanted
Good for community contributors to help [up-for-grabs]
Pri3
Indicates issues/PRs that are low priority
Milestone
I'm sometimes making HTTP requests to various APIs. Quite often, they require specifying the User-Agent header. To do that with
HttpClient
, I have to createProductInfoHeaderValue
, e.g.:My problem is that creating valid
ProductInfoHeaderValue
is not obvious and the documentation for its constructors does not explain which constructor I should use or what are the requirements for thestring
parameters.As an example, if I try
new ProductInfoHeaderValue("svick's awesome tool")
, it throws "FormatException: The format of value 'svick's awesome tool' is invalid." This doesn't help me figure out what the valid values are, which is why I think documenting this is important.This article explains the rules for User-Agent values and might be helpful when resolving this issue.
The text was updated successfully, but these errors were encountered: