diff --git a/core/server/web/members/app.js b/core/server/web/members/app.js index 16c6eede2e..c1307d5461 100644 --- a/core/server/web/members/app.js +++ b/core/server/web/members/app.js @@ -2,7 +2,6 @@ const debug = require('ghost-ignition').debug('web:members:app'); const {URL} = require('url'); const cors = require('cors'); const bodyParser = require('body-parser'); -const boolParser = require('express-query-boolean'); const express = require('../../../shared/express'); const urlUtils = require('../../lib/url-utils'); const membersService = require('../../services/members'); @@ -13,13 +12,6 @@ module.exports = function setupMembersApp() { debug('Members App setup start'); const membersApp = express('members'); - // Body parsing - membersApp.use(bodyParser.json({limit: '1mb'})); - membersApp.use(bodyParser.urlencoded({extended: true, limit: '1mb'})); - - // Query parsing - membersApp.use(boolParser()); - // send 503 json response in case of maintenance membersApp.use(shared.middlewares.maintenance); @@ -39,8 +31,9 @@ module.exports = function setupMembersApp() { membersApp.post('/webhooks/stripe', middleware.stripeWebhooks); // Initializes members specific routes as well as assigns members specific data to the req/res objects + // We don't want to add global bodyParser middleware as that interfers with stripe webhook requests on - `/webhooks`. membersApp.get('/api/member', middleware.getMemberData); - membersApp.put('/api/member', middleware.updateMemberData); + membersApp.put('/api/member', bodyParser.json({limit: '1mb'}), middleware.updateMemberData); membersApp.get('/api/session', middleware.getIdentityToken); membersApp.delete('/api/session', middleware.deleteSession); membersApp.get('/api/site', middleware.getMemberSiteData);