The code
<cfheader name="Test" value="1">
<cfheader name="Test" value="2">
results in the header "Test: 2" being sent to the browser (as seen using HttpFox).
Is there a way for the second line of code to determine if a header with the same name has already been written using CFHEADER?
Thanks!
What version of ColdFusion are you using? When I run your code on ColdFusion 9, I get the header value (As seen using FireBug):
test: 1, 2
As for whether or not you can tell what, if any, existing values there might be for the response header, I haven't yet found a way. I'll keep looking, though.
Update: Found it.
getPageContext().getResponse().containsHeader("test")
For example:
<cfif getPageContext().getResponse().containsHeader("test") eq "NO">
<cfheader name="test" value="2" />
</cfif>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With