多租户示例更新

This commit is contained in:
hello 2024-07-04 07:19:34 +08:00
parent 9a37f4b67f
commit dbabaaadba
3 changed files with 5 additions and 7 deletions

View File

@ -10,6 +10,11 @@ namespace MultiTenancySample.ServiceDefaults
const string tenantKey = "tenant"; const string tenantKey = "tenant";
if(httpContext.User.FindAll(tenantKey).Any())
{
return httpContext.User.FindFirst(tenantKey)?.Value;
}
if (httpContext.Request.Headers.TryGetValue(tenantKey, out var headerValues)) if (httpContext.Request.Headers.TryGetValue(tenantKey, out var headerValues))
{ {
return headerValues.First(); return headerValues.First();

View File

@ -1,6 +0,0 @@
{
"sdk": {
"version": "8.0.204",
"rollForward": "latestFeature"
}
}

View File

@ -21,7 +21,6 @@ namespace HelloShop.ProductService.FunctionalTests
// Assert // Assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(HttpStatusCode.OK, response.StatusCode);
} }
[Fact] [Fact]