We encountered this same bug with Preside. We found that we could always
get the HTTP body at the start of the request in
Application.cfc$onRequestStart(), but that later on in the request it was
lost. We worked around it with:
public boolean function onRequestStart( required string targetPage ) {
_readHttpBodyNowBecauseLuceeSeemsToBeSporadicallyBlankingItFurtherDownTheRequest();
…
}
private void function
_readHttpBodyNowBecauseLuceeSeemsToBeSporadicallyBlankingItFurtherDownTheRequest()
{
request.http = { body = ToString( GetHttpRequestData().content ) };
}
Then later we can refer to request.http.body.
HTH
DominicOn 14 December 2016 at 16:47, Sean Daniels <@Sean_Daniels> wrote:
Ben, I am using the exact same stack as you and I am seeing the same
behavior as well. I have a 3rd party system sending push notifications to
my app using POST and application/json.
If I call getHTTPRequestData().content in my handler it’s always empty. If
I call it earlier in my request lifecycle it contains the JSON body.
So for now as a workaround I set up a preProcess interceptor in my app and
in there I add getHTTPRequestData().content to the private request
collection:
prc.requestbody = getHTTPRequestData().content;
I suspect somewhere in the ColdBox lifecycle the content is being reset,
but i have not had the time to try to pinpoint where/when. The workaround
is adequate for me at the moment.
On Dec 13, 2016, at 2:55 PM, @ben wrote:
This is legitimately an issue. It is very difficult to reproduce, but
about 5%-ish of requests posted into one of my apps ends up having nothing
in the getHTTPRequestData.content. This post provided a decent work around:
http://stackoverflow.com/questions/23758116/coldfusion-
ajax-json-empty-request-body/24819650#24819650?newreg=
2bd57b8db5304938a5e221c13f165483.
This is the stack I am running
CFML engine: Lucee 5.1.0.34
OS: linux
Servlet: Tomcat + nginx
Framework: Coldbox 4.3
The Content-Type of the post is “application/json”
This is a pretty staggering bug imo. Has anyone else seen some of this
behavior?
–
You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/lucee/A9E1B760-E66D-4FF5-916E-2FC5BE2A6C38%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
–
Pixl8 Interactive, 3 Tun Yard, Peardon Street, London
SW8 3HT, United Kingdom
T: +44 [0] 845 260 0726• W: www.pixl8.co.uk• E: info@pixl8.co.uk
Follow us on: Facebook http://www.facebook.com/pixl8 Twitter
http://www.twitter.com/pixl8 LinkedIn http://www.linkedin.com/pixl8
CONFIDENTIAL AND PRIVILEGED - This e-mail and any attachment is intended
solely for the addressee, is strictly confidential and may also be subject
to legal, professional or other privilege or may be protected by work
product immunity or other legal rules. If you are not the addressee please
do not read, print, re-transmit, store or act in reliance on it or any
attachments. Instead, please email it back to the sender and then
immediately permanently delete it. Pixl8 Interactive Ltd Registered in
England. Registered number: 04336501. Registered office: 8 Spur Road,
Cosham, Portsmouth, Hampshire, PO6 3EB