Tower.js0.4.2-20を使用しています。
HTMLFORMタグのGETおよびPOSTリクエストを送信しました。
「GET」要求は問題のない応答です。ただし、「POST」リクエストは次のエラーを返します。
ルーターの設定がありませんか?
routers.coffee:
Tower.Route.draw ->
@resources 'service'
@match '/service/add', to: 'service#add', via: 'post'
ServiceController.coffee:
class ServiceController extends App.ApplicationController
index: ->
@render text: "GET"
create: ->
@render text: "POST"
add: ->
@render text: "ADD"
index.html:
<form method='POST' action='service/add'>
<div><input type='submit' value='Add'></div>
</form>
エラー :
Error: Forbidden
at Object.exports.error (/var/www/html/melissa/manage/development/yoshiaki-tanaka/node_modules/tower/node_modules/express/node_modules/connect/lib/utils.js:44:13)
at Object.module.exports [as handle] (/var/www/html/melissa/manage/development/yoshiaki-tanaka/node_modules/tower/node_modules/express/node_modules/connect/lib/middleware/csrf.js:54:41)
at next (/var/www/html/melissa/manage/development/yoshiaki-tanaka/node_modules/tower/node_modules/express/node_modules/connect/lib/proto.js:190:15)
at multipart (/var/www/html/melissa/manage/development/yoshiaki-tanaka/node_modules/tower/node_modules/express/node_modules/connect/lib/middleware/multipart.js:57:27)
at module.exports (/var/www/html/melissa/manage/development/yoshiaki-tanaka/node_modules/tower/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:57:9)
at IncomingMessage.module.exports (/var/www/html/melissa/manage/development/yoshiaki-tanaka/node_modules/tower/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js:68:11)
at IncomingMessage.EventEmitter.emit (events.js:115:20)
at Object.resume (/var/www/html/melissa/manage/development/yoshiaki-tanaka/node_modules/tower/node_modules/express/node_modules/connect/node_modules/pause/index.js:25:18)
at store.get.next (/var/www/html/melissa/manage/development/yoshiaki-tanaka/node_modules/tower/node_modules/express/node_modules/connect/lib/middleware/session.js:311:15)
at /var/www/html/melissa/manage/development/yoshiaki-tanaka/node_modules/tower/node_modules/express/node_modules/connect/lib/middleware/session.js:333:9