This commit is contained in:
andrei-mihnea-cerbu
2024-04-08 00:03:24 +03:00
parent 2ccec617a5
commit b48d5ee19e
168 changed files with 2877 additions and 1146 deletions
@@ -2,8 +2,8 @@
public class ApiKeyValidationMiddleware
{
private readonly RequestDelegate _next;
private const string APIKEYNAME = "ApiKey";
private readonly RequestDelegate _next;
public ApiKeyValidationMiddleware(RequestDelegate next)
{
@@ -39,4 +39,4 @@ public class ApiKeyValidationMiddleware
await _next(context);
}
}
}
@@ -17,7 +17,7 @@ public class BodyCheckMiddleware(RequestDelegate next)
var buffer = new byte[Convert.ToInt32(context.Request.ContentLength)];
await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
string requestBody = Encoding.UTF8.GetString(buffer);
var requestBody = Encoding.UTF8.GetString(buffer);
context.Request.Body.Seek(0, SeekOrigin.Begin); // Reset the stream for next middleware
// Check if the body is empty
@@ -31,5 +31,4 @@ public class BodyCheckMiddleware(RequestDelegate next)
await _next(context);
}
}
}