修改代码
This commit is contained in:
1 parent
f03e2b08f4
commit
3dcb6a1c34
24 files changed
+882
-480
No files matched your search
@@ -12,14 +12,12 @@ public sealed class ApiTransport : IDisposable
|
||||
{
|
||||
private readonly RestClient _client;
|
||||
private readonly TokenSession _session;
|
||||
private readonly string _version;
|
||||
private static readonly JsonSerializerOptions Json = new(JsonSerializerDefaults.Web);
|
||||
|
||||
internal ApiTransport(ApiClientOptions options, TokenSession session, HttpClient? httpClient)
|
||||
{
|
||||
options.Validate();
|
||||
_session = session;
|
||||
_version = options.Version;
|
||||
RestClientOptions settings = new RestClientOptions(new Uri(options.BaseUrl.AbsoluteUri.TrimEnd('/') + "/"))
|
||||
{
|
||||
Timeout = options.Timeout,
|
||||
@@ -47,7 +45,7 @@ public sealed class ApiTransport : IDisposable
|
||||
{
|
||||
throw new ApiException(ApiErrorKind.Unauthorized, "请先登录。", code: 401);
|
||||
}
|
||||
RestRequest request = new RestRequest($"{_version}/{route}", method);
|
||||
RestRequest request = new RestRequest($"/{route}", method);
|
||||
if (token is not null)
|
||||
{
|
||||
request.AddHeader("Authorization", $"Bearer {token}");
|
||||
|
||||
Reference in new issue
Block a user