AjaxRequest クラスに関するテスト スイートを作成しようとしていますが、リクエストの本文を調べようとすると、このテスト エラーが発生します。
FAILED TESTS:
AjaxRequest
#POST
✖ attaches the body to the response
PhantomJS 1.9.8 (Mac OS X 0.0.0)
Expected Object({ example: [ 'text' ] }) to equal Object({ example: 'text' }).
単体テストの関連部分は次のとおりです。
req = new AjaxRequest().post('http://example.com')
.body({
example: 'text'
}).run();
そしてrun()
、これがajaxリクエストが行われるメソッドです
var options = {
url: this._url,
method: this._method,
type: 'json',
data: this._body
};
return when(reqwest(options));
reqwestを使用して ajax リクエストを発行しています。
['text']
リクエスト'text'
がjson本体で送信されたときに期待している理由を誰かが指摘できますか?
ありがとうございました!