0

当在带有句点“.”的 url 中接收值时,Taffy 不知何故不喜欢它并且不显示结果。例如:

端点网址:

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

CF组件:

<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>

当我删除句点时,例如:

端点网址:

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

结果:

"/v1/devices/f15566dc799casdfc0b042642casdf7b1/registrations/pacomcnncom"
4

1 回答 1

0

有点晚了,但我假设你正在使用太妃糖。

Taffy,因为它解析文件扩展名以设置其响应的 mime 类型,所以在 URI 中不能有无关的“点”。显然有解决方法。. .

您可以使用正则表达式来优化 taffy_uri。
https://github.com/atuttle/Taffy/wiki/Custom-token-regular-expressions

我已经尝试过了,但没有成功,选择在 URI 上没有需要有效电子邮件地址的端点。相反,在 POST 正文中发布电子邮件地址。

更多信息在这里 https://groups.google.com/forum/#!msg/taffy-users/HbYCeCvuTLA/1-eco35pAwAJ;context-place=forum/taffy-users

B.

于 2018-12-04T18:09:43.683 回答