添加通用的option和添加201状态码判断
This commit is contained in:
parent
76b57c5717
commit
1c5b9ed3c8
@ -1,4 +1,6 @@
|
||||
namespace LMS.Common.Dictionary;
|
||||
using LMS.Common.Enum;
|
||||
|
||||
namespace LMS.Common.Dictionary;
|
||||
|
||||
public class SimpleOptions
|
||||
{
|
||||
@ -6,5 +8,6 @@ public class SimpleOptions
|
||||
{
|
||||
{ "ttsrole", ["EdgeTTsRoles"] },
|
||||
{ "laitoolinfo", ["LaitoolHomePage", "LaitoolNotice", "LaitoolUpdateContent", "LaitoolVersion"] },
|
||||
{ OptionKeyName.LaitoolFluxApiModelList, [OptionKeyName.LaitoolFluxApiModelList] }
|
||||
};
|
||||
}
|
||||
@ -199,7 +199,7 @@ public class ForwardWordService(ApplicationDbContext context)
|
||||
var response = await client.PostAsync(request.url, new StringContent(request.dataString, Encoding.UTF8, "application/json"));
|
||||
|
||||
// 判断返回的状态码
|
||||
if (response.StatusCode != HttpStatusCode.OK)
|
||||
if (response.StatusCode != HttpStatusCode.OK && response.StatusCode != HttpStatusCode.Created)
|
||||
{
|
||||
if (response.StatusCode == HttpStatusCode.Unauthorized)
|
||||
{
|
||||
@ -254,7 +254,7 @@ public class ForwardWordService(ApplicationDbContext context)
|
||||
client.Timeout = Timeout.InfiniteTimeSpan;
|
||||
var response = await client.GetAsync(getTransferModel.url);
|
||||
// 判断返回的状态码
|
||||
if (response.StatusCode != HttpStatusCode.OK)
|
||||
if (response.StatusCode != HttpStatusCode.OK && response.StatusCode != HttpStatusCode.Created)
|
||||
{
|
||||
// 读取响应体
|
||||
string responseContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user