You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added compatibility layer for deprecated statusText attribute
- Create cfHeaderUtils.cfc to detect CF version and conditionally use statusText
- Add cfHeaderHelper.cfm with global setTaffyStatusHeader() function
- Update all cfheader calls to use the new compatibility layer
- Add comprehensive test coverage for version detection and header setting
Core component class for backwards compatible HTTP status header handling for ColdFusion 2025+
3
+
where the statustext attribute has been deprecated.
4
+
5
+
This CFC provides the structured, testable implementation with dependency injection support.
6
+
For a simple global function interface, see cfHeaderHelper.cfm which wraps this component.
7
+
--->
8
+
<cfcomponenthint="Utility component for backwards compatible cfheader handling">
9
+
10
+
<!--- Cache the CF version check since it won't change during execution --->
11
+
<cfsetvariables.isCF2025OrLater=""/>
12
+
<cfsetvariables.serverInfo=""/>
13
+
14
+
<!--- Constructor to inject server information --->
15
+
<cffunctionname="init"access="public"output="false"returntype="any"hint="Constructor with optional server info injection">
16
+
<cfargumentname="serverInfo"type="struct"required="false"default="#structNew()#"hint="Server info for testing/injection"/>
17
+
18
+
<cfscript>
19
+
if (structIsEmpty(arguments.serverInfo)) {
20
+
// Only reference server scope if no injection provided
21
+
variables.serverInfo=server;
22
+
} else {
23
+
variables.serverInfo=arguments.serverInfo;
24
+
}
25
+
</cfscript>
26
+
27
+
<cfreturnthis/>
28
+
</cffunction>
29
+
30
+
<cffunctionname="setStatusHeader"access="public"output="false"returntype="void"hint="Sets HTTP status header with backwards compatibility for CF 2025">
31
+
<cfargumentname="statusCode"type="numeric"required="true"hint="HTTP status code to set"/>
32
+
<cfargumentname="statusText"type="string"required="false"default=""hint="HTTP status text (optional for CF 2025+)"/>
0 commit comments