How can I check whether Accept-Language header is present in request?
I've tried this, but it produces an error
<cfset requestData = GetHttpRequestData() >
<cfif IsDefined("requestData.Headers['Accept-Language']")>
...
Sorry for probably lame question. That's my first day of ColdFusion coding.
isDefined() is very limited in it's usage, so you can't use associative array notation with it. In almost every case you're better off using StructKeyExists() anyway. So, to solve your problem:
use:
<cfif StructKeyExists( RequestData.Headers, "Accept-Language" )>
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