Where did my request body data go? | Alan Coates – Sitecore/.NET blog
source link: https://blog.coates.dk/2021/09/30/where-did-my-request-body-data-go/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Where did my request body data go?
Problem
The solution had several API controllers (see image above) that expected data to be posted in the body. Then for no reason the body data was null, and therefore the controller started throwing argument null exceptions, and the front end of course stopped working.
The issue was caused by a new custom HttpRequestProcessor (see image below), which was called in the httpRequestBegin pipeline.
It needed the data from the request body, for some reason the setting the position back to 0, did not work?
Therefore the controller got null instead of the data contained in the body.
Solution
Therefore it was necessary to copy the stream contents into a memory stream, read the data from that stream, then deserialize the class. See the solution below.
I hope this helps, and this issue was found Sitecore 8, with a lot of customization, patches, code and modifications over the past 16 years.
Recommend
-
10
Sitecore 7.5 SQL Provider (WFFM 2.5) – Download for specific data range 1 Reply ...
-
13
How to add a button to the sitecore content editor to download data as a CSV file
-
6
Sitecore 7.5 SQL Provider (WFFM 2.5) – Added a button to download data as CSV 1 Reply...
-
10
System.Web.HttpException: Request timed out. – Installing Sitecore CMS 7.1 rev. 130926 Update Package
-
5
Ben Coates The Netherlands and beyond Skip to cont...
-
6
Site Context for ApiControllers Leave a reply Now almost every Sitecore project has rest API’s and I am alwa...
-
8
Azure Functions – Json: Self referencing loop detected for property Leave a reply ...
-
3
Sitecore config disappeared? Leave a reply We had a Sitecore 9 solution that required the include file...
-
4
Modified Microphone 2022-Feb-18 I've owned a
-
7
DC says that ‘if’ Ta-Nehisi Coates’ Superman movie is made, it’s going to be an Elseworlds / James Gunn says that Ta-Nehisi Coates and J.J. Abrams’ Superman movie might still happen, and if it does, it’ll exist in its...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK