fastify-txstate 3.0.12 → 3.1.0

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.
Files changed (2) hide show
  1. package/lib/index.js +6 -1
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -31,9 +31,10 @@ exports.prodLogger = {
31
31
  };
32
32
  },
33
33
  res(res) {
34
+ var _a;
34
35
  return {
35
36
  statusCode: res.statusCode,
36
- url: res.request.url,
37
+ url: (_a = res.request) === null || _a === void 0 ? void 0 : _a.url,
37
38
  ...res.extraLogInfo
38
39
  };
39
40
  }
@@ -125,9 +126,13 @@ class Server {
125
126
  ? async (_, resp) => {
126
127
  resp.removeHeader('X-Powered-By');
127
128
  void resp.header('Strict-Transport-Security', 'max-age=31536000');
129
+ if (resp.getHeader('content-type') === 'text/html')
130
+ void resp.type('text/html; charset=utf-8');
128
131
  }
129
132
  : async (_, resp) => {
130
133
  resp.removeHeader('X-Powered-By');
134
+ if (resp.getHeader('content-type') === 'text/html')
135
+ void resp.type('text/html; charset=utf-8');
131
136
  });
132
137
  this.app.setNotFoundHandler((req, res) => { void res.status(404).send('Not Found.'); });
133
138
  this.app.setErrorHandler(async (err, req, res) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastify-txstate",
3
- "version": "3.0.12",
3
+ "version": "3.1.0",
4
4
  "description": "A small wrapper for fastify providing a set of common conventions & utility functions we use.",
5
5
  "exports": {
6
6
  "types": "./lib-esm/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "testserver": "ts-node-script testserver/index.ts"
17
17
  },
18
18
  "dependencies": {
19
- "fastify": "^4.5.3",
19
+ "fastify": "^4.9.2",
20
20
  "http-status-codes": "^2.1.4"
21
21
  },
22
22
  "devDependencies": {