core binds request body to query param after adding middleware

first of all, i am new to dotnet. i have an core web api application.

i have added an encryption middleware to my project to encrypt request/response stream. here is the code

public async Task Invoke(HttpContext httpContext, IRequestContext requestContext)
            if (!httpContext.Request.Path.StartsWithSegments("/swagger"))
                var plainRequestBody = httpContext.Request.Body;
                var rsa = RSAGenerator.GenerateRSAKeyPair(requestContext.Client.KeyPair);
                var encryptedPayload = await CreateEncryptedPayloadAsync(plainRequestBody);
                var encryptedKey = encryptedPayload!.ExtractEncryptedKeyFromPayload(rsa);
                Aes aes = EncryptionHelper.CreateEncryptionAlgorithm(encryptedKey);
                httpContext.Response.Body = EncryptResponseStream(httpContext.Response.Body, aes);
                httpContext.Request.Body = DecryptRequestStream(httpContext.Request.Body, aes);
                httpContext.Request.QueryString =
                    await DecryptRequestQueryStringAsync(httpContext.Request.QueryString, aes);

            await _next(httpContext);
            await httpContext.Request.Body.DisposeAsync();
            await httpContext.Response.Body.DisposeAsync();

i have excluded swagger because of having both encryption and swagger ui in development environment.

after adding this middleware to my project, requests successfully decrypted and response successfully encrypted but! now recognize my DTO classes as query params and fluentValidations asks me to fill required item. here is sample api

public async Task<CreateWalletViewModel> CreateWallet(CreateWalletCommand command)
        var result = await Mediator.Send(command);
        return Mapper.Map<CreateWalletViewModel>(result);

in the above code, here is error : The command field is required.