Not sure if this is Lucee-specific or not, but a q...
# cfml-general
p
Not sure if this is Lucee-specific or not, but a question to all: if any of you query an OData source using the properly URL structure, then you know that the URL should not be URL-encoded. I can turn off that encoding in a
cfhttp
tag using
encodeurl="false"
, but then I’m getting this from my Lucee server:
Illegal character in query at index 102
It’s complaining about my URL before it even sends it to my OData source. Is there a clear and easy solution to this? Not sure if there’s a setting in Lucee (5.4.3.2) to override this or if it’s a CFML language issue. Any help appreciated!
s
You'd want to dump the query string you're sending. If you're not URL encoding, there are some characters that can't be sent in a GET request
p
I’ve got the full string for the URL and it’s been tested with Postman. The URL string works fine but it’s getting blocked from even being sent at the Java level.
s
Are you sure postman isn't encoding it?
p
The string isn’t showing with any encoding. I’m not tracing the network activity but… I think it’s not.
s
And it has to be a GET request? The fact that Java won't parse it tells me the problem is the string, not some incompatibility. Saying 'I want to send this as a query string but I don't want to URL encode it' limits the acceptable characters to those that are legal in a query string. It is therefore not surprising that you might have an illegal character in there. I'd check online URL parsers to see if your string can break any of those and otherwise try to find exactly the character that is breaking (e.g. keep editing the string until Java accepts it) so you know who the culprit is.
p
OK. Will need to reapproach. Looking at official OData specs, it appears that encoded URL’s are accepted, so something else is tripping this up. Is there a way to see the final string being sent via
cfhttp
? I’m using
cfhttparam
to assign the URL variables, but I’ve also just put the entire string in the
URL
field…
s
We use https://forgebox.io/view/hyper to help with this kind of thing. It just wraps cfhttp under the hood (unless you ask it to use bolt) but it makes debugging requests and response 100x easier. Doesn't require Coldbox