mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 05:42:32 +03:00
Removed global bodyParser middleware for members app
no issue
- Removes global bodyParser middleware for membersApp and adds it to specific endpoints
- Removes global boolParser middleware for membersApp
We added bodayParser middleware to memebrsApp in [this](fe3eab1836
) commit to read json requests for members update endpoint, but that had issues with stripe webhook parsing for `/webhooks` endpoint as stripe expects raw data to be passed down.
This commit is contained in:
parent
21d38b2d37
commit
65656a9cf4
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user