-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: #5533 - Enabled reading request body for HTTP POST requests. #13853
Conversation
@dotnet-policy-service agree company="Medyasoft" |
Hi @sebastienros can you review this PR. |
{ | ||
parameters = Request.Query["parameters"].ToString(); | ||
} | ||
else if (Request.Method == "POST") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a breaking change. Before even in a POST the parameters
query string would have been read, now it's not.
Instead could you check if the qyery string is set, and if not use the body when in a POST.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I fixed it. If the parameters are empty as query string in Post type, I get the request body value.
This way I can pass the long parameters I need.
Example:
{ "EmployeeIds": "4s726tsb5jpdhrny3v0759jjw0,4znzn2eecdazvrc2kh2vhm4yn9,4ggs0tgqrat127jgsrps1rr75g,4dts0wxjsp5p1saeprkk67redt,4dts0wxjsp5p1saeprkk67redt,48bweg5d4chwn08yzc1brwys5v" }
This pull request has merge conflicts. Please resolve those before requesting a review. |
src/OrchardCore.Modules/OrchardCore.Queries/Controllers/ApiController.cs
Outdated
Show resolved
Hide resolved
…uests. (OrchardCMS#13853) Co-authored-by: emrah.tokalak <[email protected]> Co-authored-by: Sébastien Ros <[email protected]>
It is provided to read the data in the body of the requests sent in post type.
Example Post request:
curl --location 'http://localhost:5001/api/queries/YourQueryName' \ --header 'Content-Type: application/json' \ --data '{ "EmployeeIds": "4s726tsb5jpdhrny3v0759jjw0,4znzn2eecdazvrc2kh2vhm4yn9,4ggs0tgqrat127jgsrps1rr75g,4dts0wxjsp5p1saeprkk67redt,4dts0wxjsp5p1saeprkk67redt,48bweg5d4chwn08yzc1brwys5v" }'
Javascript example: