Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removes the need to use "format=js" which also makes it fall back int…

…o a normal request when javascript is disabled
  • Loading branch information...
commit 13c9591abb846eb6e3b27d97afd6cf9a17496da4 1 parent e22005b
@raulriera raulriera authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 RemoteFormHelpers.cfc
View
19 RemoteFormHelpers.cfc
@@ -299,4 +299,23 @@
<cfreturn loc.returnValue>
</cffunction>
+ <cffunction name="$requestContentType" access="public" output="false" returntype="string">
+ <cfargument name="params" type="struct" required="false" default="#variables.params#" />
+ <cfargument name="httpAccept" type="string" required="false" default="#request.cgi.http_accept#" />
+ <cfscript>
+ var loc = {};
+ loc.format = "html";
+
+ // see if we have a format param
+ if (StructKeyExists(arguments.params, "format"))
+ return arguments.params.format;
+
+ for (loc.item in application.wheels.formats) {
+ if (arguments.httpAccept CONTAINS application.wheels.formats[loc.item])
+ return loc.item;
+ }
+ </cfscript>
+ <cfreturn loc.format />
+ </cffunction>
+
</cfcomponent>
Please sign in to comment.
Something went wrong with that request. Please try again.