Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added support for the PATCH verb (RFC 5789)

  • Loading branch information...
commit fcd776b923adda68611a361d651f2b44bb1102ec 1 parent 2469893
@jbvanzuylen jbvanzuylen authored
Showing with 6 additions and 6 deletions.
  1. +2 −2 core/api.cfc
  2. +4 −4 dashboard/dashboard.cfm
View
4 core/api.cfc
@@ -188,7 +188,7 @@
<!--- CORS headers (so that CORS can pass even if the resource throws an exception) --->
<cfset local.allowVerbs = uCase(structKeyList(_taffyRequest.matchDetails.methods)) />
<cfif application._taffy.settings.allowCrossDomain
- AND listFindNoCase('PUT,DELETE,OPTIONS',_taffyRequest.verb)
+ AND listFindNoCase('PUT,PATCH,DELETE,OPTIONS',_taffyRequest.verb)
AND NOT listFind(local.allowVerbs,'OPTIONS')>
<cfset local.allowVerbs = listAppend(local.allowVerbs,'OPTIONS') />
</cfif>
@@ -850,7 +850,7 @@
<cfset application._taffy.endpoints[local.metaInfo.uriRegex] = { beanName = local.cachedBeanName, tokens = local.metaInfo.tokens, methods = structNew(), srcURI = local.uri } />
<cfif structKeyExists(local.cfcMetadata, "functions")>
<cfloop array="#local.cfcMetadata.functions#" index="local.f">
- <cfif local.f.name eq "get" or local.f.name eq "post" or local.f.name eq "put" or local.f.name eq "delete" or local.f.name eq "head" or local.f.name eq "options">
+ <cfif local.f.name eq "get" or local.f.name eq "post" or local.f.name eq "put" or local.f.name eq "patch" or local.f.name eq "delete" or local.f.name eq "head" or local.f.name eq "options">
<cfset application._taffy.endpoints[local.metaInfo.uriRegex].methods[local.f.name] = local.f.name />
<!--- also support future/misc verbs via metadata --->
View
8 dashboard/dashboard.cfm
@@ -207,7 +207,7 @@
<a href="###local.currentResource.beanName#" class="accordion-toggle" data-toggle="collapse" data-parent="##resourcesAccordion">
#local.currentResource.beanName#
</a>
- <cfloop list="DELETE|warning,PUT|warning,POST|danger,GET|primary" index="local.verb">
+ <cfloop list="DELETE|warning,PATCH|warning,PUT|warning,POST|danger,GET|primary" index="local.verb">
<cfif structKeyExists(local.currentResource.methods, listFirst(local.verb,'|'))>
<span class="verb label label-success">#ucase(listFirst(local.verb,'|'))#</span>
<cfelse>
@@ -225,7 +225,7 @@
<button class="btn btn-success resetRequest">Reset</button>
<button class="btn btn-default showDocs">Show Docs</button>
<select class="form-control input-sm reqMethod">
- <cfloop list="GET,POST,PUT,DELETE" index="local.verb">
+ <cfloop list="GET,POST,PUT,PATCH,DELETE" index="local.verb">
<cfif structKeyExists(local.currentResource.methods, local.verb)>
<option value="#local.verb#">#local.verb#</option>
</cfif>
@@ -288,7 +288,7 @@
</cfif>
<!--- only save body templates for POST & PUT --->
<cfloop from="1" to="#arrayLen(local.functions)#" index="local.f">
- <cfif local.functions[local.f].name eq "POST" or local.functions[local.f].name eq "PUT">
+ <cfif local.functions[local.f].name eq "POST" or local.functions[local.f].name eq "PUT" or local.functions[local.f].name eq "PATCH">
<cfset local.args = {} />
<!--- get a list of all function arguments --->
<cfloop from="1" to="#arrayLen(local.functions[local.f].parameters)#" index="local.parm">
@@ -338,7 +338,7 @@
<cfset local.metadata = getMetaData(application._taffy.factory.getBean(local.currentResource.beanName)) />
<cfset local.docData = getHintsFromMetadata(local.metadata) />
<cfif structKeyExists(local.docData, 'hint')><div class="doc">#docData.hint#</div><hr/></cfif>
- <cfset local.found = { get=false, post=false, put=false, delete=false } />
+ <cfset local.found = { get=false, post=false, put=false, patch=false, delete=false } />
<cfloop from="1" to="#arrayLen(local.docData.functions)#" index="local.f">
<cfset local.func = local.docData.functions[local.f] />
<cfset local.found[local.func.name] = true />
Please sign in to comment.
Something went wrong with that request. Please try again.