From 1e1694c1d5fd70dfe1da41cb2ae9d8fc6c3141ce Mon Sep 17 00:00:00 2001 From: Marin Atanasov Date: Fri, 9 Dec 2016 15:31:40 +0200 Subject: [PATCH] Undocumented: Stringify POST body properly in updateJetpackModuleSettings() --- client/lib/wpcom-undocumented/lib/undocumented.js | 2 +- client/state/jetpack-settings/module-settings/test/actions.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/lib/wpcom-undocumented/lib/undocumented.js b/client/lib/wpcom-undocumented/lib/undocumented.js index 50a6c724da460a..7c79dfe4654247 100644 --- a/client/lib/wpcom-undocumented/lib/undocumented.js +++ b/client/lib/wpcom-undocumented/lib/undocumented.js @@ -122,7 +122,7 @@ Undocumented.prototype.updateJetpackModuleSettings = function( siteId, moduleSlu //@TODO: implement and test this endpoint, it's currently not working return this.wpcom.req.post( { path: '/jetpack-blogs/' + siteId + '/rest-api/' }, - { path: '/module/' + moduleSlug, body: settings }, + { path: '/module/' + moduleSlug, body: JSON.stringify( settings ) }, fn ); }; diff --git a/client/state/jetpack-settings/module-settings/test/actions.js b/client/state/jetpack-settings/module-settings/test/actions.js index 8fa2368d66fbdb..9d4a8a4055670e 100644 --- a/client/state/jetpack-settings/module-settings/test/actions.js +++ b/client/state/jetpack-settings/module-settings/test/actions.js @@ -107,7 +107,7 @@ describe( 'actions', () => { .persist() .post( '/rest/v1.1/jetpack-blogs/' + siteId + '/rest-api/', { path: '/module/' + moduleSlug, - body: settings + body: JSON.stringify( settings ) } ) .reply( 200, { code: 'success' @@ -145,7 +145,7 @@ describe( 'actions', () => { .persist() .post( '/rest/v1.1/jetpack-blogs/' + siteId + '/rest-api/', { path: '/module/' + moduleSlug, - body: settings + body: JSON.stringify( settings ) } ) .reply( 400, { message: 'Invalid option: setting_1'