Taffy framework not accepting period "." in URL

140 views Asked by At

When receiving values in a url with a period ".", somehow Taffy doesn't like it and doesn't show results. For example:

Endpoint URL:

mydomain.com/v1/devices/f15566dc799casdfc0b042642casdf7b1/registrations/pa.com.cnn.com

CFComponent:

<cfcomponent extends="taffy.core.resource" 
      taffy:uri="/v1/devices/{deviceid}/registrations/{registrationid}" >
  <cffunction name="get" access="public" output="false" >
    <cfset var retCode = 200>
     <cfreturn representationOf("/v1/devices/#arguments.deviceid#/registrations/#arguments.registrationid#").withStatus(retCode) />
  </cffunction>
</cfcomponent>

When I remove the periods, for example:

Endpoint URL:

mydomain.com/v1/devices/f15566dc799casdfc0b042642casdf7b1/registrations/pacomcnncom 

Results:

"/v1/devices/f15566dc799casdfc0b042642casdf7b1/registrations/pacomcnncom"
1

There are 1 answers

1
Brian Harcourt On

A bit late but I assume you're using Taffy.

Taffy, because it parses for file extensions to set mime-types of its responses, cannot have extraneous 'dots' in the URI. There are workarounds apparently . . .

You can use regex to refine the taffy_uri.
https://github.com/atuttle/Taffy/wiki/Custom-token-regular-expressions

I've tried this but not had success, opting to not have an end point requiring valid email address on the URI. Instead, posting the email address in the POST body.

More info here https://groups.google.com/forum/#!msg/taffy-users/HbYCeCvuTLA/1-eco35pAwAJ;context-place=forum/taffy-users

B.