Project

General

Profile

Backport(バックポート) #3330

opJsonApiActions 内で Content-Type の設定が2度呼び出されている

Added by Chiharu Nakajima almost 10 years ago. Updated almost 10 years ago.

Status:
Fixed(完了)
Priority:
Normal(通常)
Assignee:
Target version:
Start date:
2013-04-15
Due date:
% Done:

100%


Description

Overview (現象)

opJsonApiActions クラス内で $this->getResponse()->setContentType('application/json') が execute() メソッドと renderJSON() メソッドで 2 度呼び出されている。また、これによって各 API のアクション内で Content-Type の設定を上書きすることが出来ない。

(現象補足)
apiを使用しているプラグインでは、使用しているjavascriptライブラリとの都合上、content-typeが「text/html」である必要があるものがあります。
(デフォルトでライブラリの中でstringをjsonオブジェクトに変換します。)
そのため、actionsのexecuteXxx()内でcontent-typeの書き換えを行っています。
その変更をopJsonApiActionsのrenderJSON()で「application/json」に再度置き換えられるために不具合発生となります。

Way to fix (修正内容)

opJsonApiActions::renderJSON() メソッド内の setContentType の呼び出しが不要なため除去する。


Related issues

Related to OpenPNE 3 - Bug(バグ) #3198: opJsonApiActions 内で Content-Type の設定が2度呼び出されている Won't fix(対応せず) 2012-09-11

Associated revisions

Revision 0a95a9cf (diff)
Added by kaoru n almost 10 years ago

(refs #3330 BP from #3198) remove unnecessary calling sfWebResponce::setContentType() twice in opJsonApiActions

Revision 8579ec65
Added by Yuya Watanabe almost 10 years ago

Merge remote-tracking branch 'origin/pr/77' into stable-3.8.x (fixes #3330)

History

#1 Updated by kaoru n almost 10 years ago

  • Status changed from New(新規) to Accepted(着手)
  • Assignee set to kaoru n

#2 Updated by kaoru n almost 10 years ago

  • Status changed from Accepted(着手) to Pending Review(レビュー待ち)
  • % Done changed from 0 to 50

https://github.com/openpne/OpenPNE3/pull/77
プルリクエストしました。

#3 Updated by Yuya Watanabe almost 10 years ago

下記と同じ理由でマージはまだしていません.

https://redmine.openpne.jp/issues/3198#note-6

#4 Updated by kaoru n almost 10 years ago

原因について

https://redmine.openpne.jp/issues/3198#note-6
のとおりですが、少しだけ補足します。

apiを使用しているプラグインでは、使用しているjavascriptライブラリとの都合上、content-typeが「text/html」である必要があるものがあります。
(デフォルトでライブラリの中でstringをjsonオブジェクトに変換します。)
そのため、actionsのexecuteXxx()内でcontent-typeの書き換えを行っています。
その変更をopJsonApiActionsのrenderJSON()で「application/json」に再度置き換えられるために不具合発生となります。

上記についてチケット本文にも記載を行いました。

#5 Updated by kaoru n almost 10 years ago

  • Description updated (diff)

#6 Updated by Yuya Watanabe almost 10 years ago

  • Status changed from Pending Review(レビュー待ち) to Pending Testing(テスト待ち)
  • % Done changed from 50 to 70

#7 Updated by Yuya Watanabe almost 10 years ago

  • Status changed from Pending Testing(テスト待ち) to Pending Review(レビュー待ち)
  • % Done changed from 70 to 50

更新履歴 8579ec654a1df2c5df6683c13c43b6a895f4a5d8 で適用されました。

#8 Updated by Yuya Watanabe almost 10 years ago

  • Status changed from Pending Review(レビュー待ち) to Pending Testing(テスト待ち)
  • % Done changed from 50 to 70

ステータスが戻っていたのでテスト待ちに戻します

#9 Updated by Chiharu Nakajima almost 10 years ago

  • Status changed from Pending Testing(テスト待ち) to Fixed(完了)
  • % Done changed from 70 to 100

確認しました。問題ありません。
チケットをクローズします。

Also available in: Atom PDF