Skip to content

Commit

Permalink
Fix: OrchardCMS#5533 - Enabled reading request body for HTTP POST req…
Browse files Browse the repository at this point in the history
…uests. (OrchardCMS#13853)

Co-authored-by: emrah.tokalak <emrah.tokalak@medyasoft.com.tr>
Co-authored-by: Sébastien Ros <sebastienros@gmail.com>
  • Loading branch information
3 people committed Feb 2, 2024
1 parent 8c3a2fd commit 042caa6
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace OrchardCore.Queries.Controllers
Expand Down Expand Up @@ -43,7 +46,13 @@ IQueryManager queryManager
return NotFound();
}

var queryParameters = parameters != null ?
if (Request.Method == HttpMethods.Post && string.IsNullOrEmpty(parameters))
{
using var reader = new StreamReader(Request.Body, Encoding.UTF8);
parameters = await reader.ReadToEndAsync();
}

var queryParameters = !string.IsNullOrEmpty(parameters) ?
JConvert.DeserializeObject<Dictionary<string, object>>(parameters)
: [];

Expand Down

0 comments on commit 042caa6

Please sign in to comment.