Not sure if this is more appropriate as a Language question or Dev question but I’ll try here.
I found an issue while trying to port some websites from CF to Lucee with regards to Content-Type headers in remote function calls. I’ve confirmed identical behavior that ColdFusion functions identically with both CF 11 and CF 2021 but Lucee behaves differently. For Lucee, I tested with an installed version on Windows 2022 server (IIS) and with Commandbox locally on my dev machine (the results are consistent with both).
I’m aware that arrays are passed by reference instead of value but this does not appear to be what is happening as this same result is true of strings, arrays, and structs.
component output="false" {
remote function testArray() returnFormat="json" {
return [0, 1, 2, 3];
}
remote function testStruct() returnFormat="json" {
return {v0=0, v1=1, v2=2, v3=3};
}
remote function testString() returnFormat="json" {
return "0, 1, 2, 3";
}
}
Given a CFC as shown above running in Lucee 6.0.1 and also in ColdFusion 11 or 2021 (two I tested), I get different Content-Type responses for the functions.
Lucee Content-Type response to all 3 of the functions above:
application/json;charset=UTF-8
ColdFusion Content-Type response to all 3 of the functions above:
text/html;charset=UTF-8
I am not sure if there’s a global setting somewhere that could affect the output but if my ajax calls suddenly begin passing strings as objects, I’d have to hunt all over my code to find and fix type conversions. And that could be quite arduous. I’m hoping there’s a simple solution to explain WHY and to hopefully fix. But any ideas on what’s happening or a simple way to fix without having to individually analyze 2,000+ functions in each of the projects I’m porting over?
I’m assuming this is restricted to “remote” function calls but I suppose it may not necessarily be so depending on the exact cause.