2016-11-21 100 views
1

我有連接到瓶的RESTful資源的路線:瓶不匹配的路由

api.add_resource(File, '/api/files/<int:id>') 

如果我現在想通過

/api/files/89?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc0FkbWluIjp0cnVlLCJ1c2VySWQiOjEsImV4cCI6MTQ3OTg0MTcxN30.DkoPeMeXms9j0nzmEAsGKOpIi_cRyTf4m6mQJjl17o0 

訪問路徑獲得:

"The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. You have requested this URI [/api/files/89] but did you mean /api/files/<int:id> or /api/files or /api/users/<int:id> ?" 

如果我試着簡單地說:

/api/files/89 

沒有查詢參數,一切工作正常。

問題在哪裏?

+3

看起來您的密鑰不是網址編碼的。我相信那些'.'字符需要被正確編碼。 – sytech

+0

@sytech你可以直接在瀏覽器開發工具中嘗試:''。 === encodeURIComponent('。')'給出'true'。所以,'.'不需要以某種方式編碼。 –

+0

@Lelsoos,你能否給我們提供錯誤信息中提到的其他路線? –

回答

0

我解決了這個問題。它不是與路由器相關的東西,而是我弄亂了視圖邏輯。