-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
メンバーシップ登録していないプロジェクトに対して issue を作成しようとしたとき、メンバーシップ登録がされていないことに対するエラーではなく、プロジェクトIDやトラッカーIDが入力されていないことに対するエラーが返ってくるのは挙動として不自然。
再現手順:
- Fixturesを読み込み
bundle exec rake db:fixtures:load
- システム管理者アカウント(
admin
/admin
)でログインし、Settings / API から、Enable REST web service
をチェックONして保存 - システム管理者アカウントをログアウトし、
rhill
/foo
でログイン後、右上のMy accountからAPI access key
下のShow
をクリックして、APIキーを生成 - curlで
rhill
ユーザーが参加していないプライベートプロジェクト(ID: 5,Private child of eCookbook
)に対して、IssueのPOST(作成)リクエストを実行。curl -v -H "Content-Type: application/json" \ -d '{"issue":{"project_id":5,"subject":"None member issue","tracker_id":1}}' \ 'http://localhost:3000/issues.json?key=(rhillのAPIキー)'
- 以下の分かりにくいエラーコード・メッセージが返される。
: < HTTP/1.1 422 Unprocessable Entity : {"errors":["Project cannot be blank","Tracker cannot be blank","Status cannot be blank"]}
※補足: プロジェクトのメンバーである admin
, jsmith
アカウントでは、上記のエラーは発生せず、正しくIssueの作成が完了する。
curl -v -H "Content-Type: application/json" \
-d '{"issue":{"project_id":5,"subject":"None member issue","tracker_id":1}}' \
'http://localhost:3000/issues.json?key=(adminもしくはjsmithのAPIキー)'
結果:
:
< HTTP/1.1 201 Created
:
{"issue":{"id":17,"project":{"id":5,"name":"Private child of eCookbook"}...