api v2.0
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user