@fastify/express 4.0.7 → 4.0.8
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/.github/workflows/ci.yml +1 -1
- package/.github/workflows/lock-threads.yml +1 -1
- package/.github/workflows/release.yml +24 -0
- package/README.md +1 -1
- package/index.js +0 -1
- package/package.json +3 -3
- package/test/basic.test.js +22 -0
package/.github/workflows/ci.yml
CHANGED
|
@@ -27,7 +27,7 @@ jobs:
|
|
|
27
27
|
permissions:
|
|
28
28
|
contents: write
|
|
29
29
|
pull-requests: write
|
|
30
|
-
uses: fastify/workflows/.github/workflows/plugins-ci.yml@
|
|
30
|
+
uses: fastify/workflows/.github/workflows/plugins-ci.yml@ef591e2186785d5ab36b9fe6a79c7ce2f1d94e57 # v7.0.0
|
|
31
31
|
with:
|
|
32
32
|
license-check: true
|
|
33
33
|
lint: true
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Release the package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
semver:
|
|
7
|
+
description: 'Release bump type'
|
|
8
|
+
required: true
|
|
9
|
+
type: choice
|
|
10
|
+
options:
|
|
11
|
+
- patch
|
|
12
|
+
- minor
|
|
13
|
+
- major
|
|
14
|
+
|
|
15
|
+
permissions: {}
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
release:
|
|
19
|
+
permissions:
|
|
20
|
+
id-token: write # required for npm provenance via OIDC
|
|
21
|
+
contents: write # required to push the release commit and the tag
|
|
22
|
+
uses: fastify/workflows/.github/workflows/reusable-release.yml@b1a11bce713bc857e52b2231fec3c89071ad3135
|
|
23
|
+
with:
|
|
24
|
+
semver: ${{ inputs.semver }}
|
package/README.md
CHANGED
|
@@ -156,7 +156,7 @@ async function subsystem (fastify, opts) {
|
|
|
156
156
|
### Hooks and middleware
|
|
157
157
|
|
|
158
158
|
Every registered middleware will be run during the `onRequest` hook phase, so the registration order is important.
|
|
159
|
-
Take a look at the [Lifecycle](https://fastify.dev/docs/latest/Reference/Lifecycle) documentation page to understand better how every request is executed.
|
|
159
|
+
Take a look at the [Lifecycle](https://fastify.dev/docs/latest/Reference/Lifecycle/) documentation page to understand better how every request is executed.
|
|
160
160
|
|
|
161
161
|
```js
|
|
162
162
|
const fastify = require('fastify')()
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastify/express",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.8",
|
|
4
4
|
"description": "Express compatibility layer for Fastify",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
}
|
|
60
60
|
],
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@fastify/formbody": "^
|
|
62
|
+
"@fastify/formbody": "^9.0.0",
|
|
63
63
|
"@types/express": "^5.0.0",
|
|
64
64
|
"@types/node": "*",
|
|
65
65
|
"body-parser": "^1.20.2",
|
|
66
|
-
"c8": "^
|
|
66
|
+
"c8": "^12.0.0",
|
|
67
67
|
"cors": "^2.8.5",
|
|
68
68
|
"eslint": "^9.17.0",
|
|
69
69
|
"fastify": "^5.0.0",
|
package/test/basic.test.js
CHANGED
|
@@ -66,6 +66,28 @@ test('Should support connect style middlewares (async await after)', async t =>
|
|
|
66
66
|
t.assert.deepStrictEqual(await result.json(), { hello: 'world' })
|
|
67
67
|
})
|
|
68
68
|
|
|
69
|
+
test('Should expose Fastify cookies to Express middleware', async t => {
|
|
70
|
+
t.plan(2)
|
|
71
|
+
const fastify = Fastify()
|
|
72
|
+
t.after(() => fastify.close())
|
|
73
|
+
|
|
74
|
+
fastify.addHook('onRequest', (request, _reply, done) => {
|
|
75
|
+
request.cookies = { session: 'cookie-value' }
|
|
76
|
+
done()
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
await fastify.register(expressPlugin)
|
|
80
|
+
fastify.use((request, _response, next) => {
|
|
81
|
+
t.assert.deepStrictEqual(request.cookies, { session: 'cookie-value' })
|
|
82
|
+
next()
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
fastify.get('/', async () => ({ hello: 'world' }))
|
|
86
|
+
|
|
87
|
+
const response = await fastify.inject('/')
|
|
88
|
+
t.assert.strictEqual(response.statusCode, 200)
|
|
89
|
+
})
|
|
90
|
+
|
|
69
91
|
test('Should support per path middlewares', async t => {
|
|
70
92
|
t.plan(2)
|
|
71
93
|
const fastify = Fastify()
|