@apolitical/server 2.3.0 → 2.3.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.3.1] - 2022-02-15
9
+ ### Changed
10
+ - Body parser types
11
+
8
12
  ## [2.3.0] - 2022-02-14
9
13
  ### Added
10
14
  - fallbackController
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/server",
3
- "version": "2.3.0",
3
+ "version": "2.3.1-beta.1",
4
4
  "description": "Node.js module to encapsulate Apolitical's express server setup",
5
5
  "author": "Apolitical Group Limited <engineering@apolitical.co>",
6
6
  "license": "MIT",
package/src/config.js CHANGED
@@ -35,7 +35,12 @@ module.exports = {
35
35
  credentials: true,
36
36
  },
37
37
  BODY_PARSER_OPTIONS: {
38
- extended: false,
38
+ JSON_OPTIONS: {
39
+ type: ['application/json', 'application/csp-report', 'application/reports+json'],
40
+ },
41
+ URL_ENCODED_OPTIONS: {
42
+ extended: false,
43
+ },
39
44
  },
40
45
  MORGAN_OPTIONS: {
41
46
  LOGGED_OUT_SLUG: 'logged-out',
@@ -10,15 +10,18 @@ module.exports = ({
10
10
  config,
11
11
  logger,
12
12
  }) => {
13
- const { BODY_PARSER_OPTIONS, CORS_OPTIONS } = config.SERVER;
13
+ const {
14
+ BODY_PARSER_OPTIONS: { JSON_OPTIONS, URL_ENCODED_OPTIONS },
15
+ CORS_OPTIONS,
16
+ } = config.SERVER;
14
17
 
15
18
  return function load(app, { corsOptions, prerenderToken, staticFiles }) {
16
19
  const childLogger = logger.where(__filename, 'load');
17
20
  childLogger.debug('Started');
18
21
  // Load useful middlewares
19
22
  app.use(cookieParser());
20
- app.use(json());
21
- app.use(urlencoded(BODY_PARSER_OPTIONS));
23
+ app.use(json(JSON_OPTIONS));
24
+ app.use(urlencoded(URL_ENCODED_OPTIONS));
22
25
  app.use(cors(Object.assign({}, CORS_OPTIONS, corsOptions)));
23
26
  app.use(compression());
24
27
  if (prerenderToken) {