RE: [coldbox:3154] Re: getting the body of a POST

LOL-- honestly I'm neutral on this one, but don't most of these
arguments also apply to things like form and URL variables? They're all
sent in the HTTP request header and ColdFusion provides a handy-built-in
way of accessing them. I mean, why bother with a complicated "request
collection" when we have the "form." and "url." scope? :wink:

I don't buy the keep it the simplest possible argument, or I wouldn't be
using ColdBox. Now the "I've only needed getHTTPRequestData().content
like once in 10 years of CF programming" argument-- that one might hold
a little more water. :slight_smile: A main purpose of the request collection to me
is to abstract the source of all incoming arguments and consolidate
them. I think the better argument here is should ColdBox provide
functionality for things only used 5% of the time?


After reading that, that is exactly how I feel about it. I just didn’t know how to word it in a way that would sound nice. “Hell, I don’t need it, so you can’t have it!” just doesn’t seem to be the right thing to say. :slight_smile:

Anyways, without doing a performance test to find out if adding a rarely used piece of data onto every request would have a negative impact, I am, like Brad, neutral on it. However, my gut tells me that there would be negative effects on a large scale application, since milliseconds add up just the same as seconds or minutes do. It just takes a lot more of them. And ultimately, that is why I would lean toward using the decorator to make it happen if you need it for a particular use case.


After much comments, I am still divided on this.

I see the benefit if this being in the rc, the problem is that the rc is a collection of both form/url or remote variables sent in. And the key thing here is that these values are name-value pairs, not a POST submit packet. Because the body of the content will only happen in POST,DELETE or PUT operations and not GET.

Also, if they do come in, what name do you give it? Content? rc.content? Also, this should only happen if the content has NO name value pairs, because if not, you are replicating the submission and inflate the RC with unnecessary data.

So the thing is that on request capture, the content would have to be checked for name value pairs, how? I can’t check for an = and then not do that, because the submission can have an ='s on its submission. So how do you distinguish?

Also, since this is not a use case that is for almost all applications, my gut tells me that if I am doing something like this, I can just decorate my context with a capture that does this for me?

Or maybe why not even do this on a per-handler or event basis?

Have a preHandler() method that populates the RC with the content. Then all actions on that handler have it.