This switches both OAuth2 and Query to use HttpClient (provided by new dependency System.Net.Http) instead of the deprecated WebClient.
This brings with it a slew of breaking API changes:
In both OAuth2 and Query:
Changes to constructor signatures
New: an HttpClient instance can be provided
The ownership of that client can stay with the caller, in which case that is the only client that will be used, and Close() throws an exception.
Otherwise, an HttpClient instance will be created whenever needed, and Close() can be used to ensure any such client is cleaned up (with the next request creating a new one).
Both the creation and further configuration of such clients can be done via user code.
Because of this use of a externally-created clients, request behaviour has been adjusted. They will:
use absolute URIs constructed using the UrlScheme, Server and Port properties (so any base address set on the client will be ignored)
use application/json for the Accept header (so any default value configured on the client for that header is ignored)
add the library name and version at the end of the UserAgent header (so any default value configured on the client for that header is honored)
The [Default]WebSite property has been renamed to [Default]Server.
In Query only:
DefaultUserAgent and UserAgent are now a list of header values instead of a single string
UserAgentUrl was dropped
Elsewhere:
QueryException now has two additional fields (Code and Reason), with new and change constructor signatures
This switches both
OAuth2
andQuery
to useHttpClient
(provided by new dependencySystem.Net.Http
) instead of the deprecatedWebClient
.This brings with it a slew of breaking API changes:
OAuth2
andQuery
:HttpClient
instance can be providedClose()
throws an exception.HttpClient
instance will be created whenever needed, andClose()
can be used to ensure any such client is cleaned up (with the next request creating a new one). Both the creation and further configuration of such clients can be done via user code.UrlScheme
,Server
andPort
properties (so any base address set on the client will be ignored)application/json
for theAccept
header (so any default value configured on the client for that header is ignored)UserAgent
header (so any default value configured on the client for that header is honored)[Default]WebSite
property has been renamed to[Default]Server
.Query
only:DefaultUserAgent
andUserAgent
are now a list of header values instead of a single stringUserAgentUrl
was droppedQueryException
now has two additional fields (Code
andReason
), with new and change constructor signatures