Skip to content

Commit

Permalink
feat(afdian.server/startup.cs): 任意跨域
Browse files Browse the repository at this point in the history
  • Loading branch information
yiyungent committed Dec 9, 2021
1 parent f65c360 commit 73a7484
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Afdian.Server/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ public void ConfigureServices(IServiceCollection services)
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
});

// 任意跨域
services.AddCors(options =>
{
options.AddDefaultPolicy(policyBuilder =>
{
policyBuilder.AllowAnyHeader()
.AllowAnyMethod()
.AllowAnyOrigin();
});
});

// The Telegram.Bot library heavily depends on Newtonsoft.Json library to deserialize
// incoming webhook updates and send serialized responses back.
// Read more about adding Newtonsoft.Json to ASP.NET Core pipeline:
Expand Down

0 comments on commit 73a7484

Please sign in to comment.