Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to Fastify v4 #114

Merged
merged 7 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-jest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 16.x]
node-version: [14.x, 16.x, 18.x]
os: [ubuntu-latest]
continue-on-error: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 16.x]
node-version: [14.x, 16.x, 18.x]
os: [macos-latest, ubuntu-latest, windows-latest]

steps:
Expand Down
4 changes: 2 additions & 2 deletions lib/requestContextPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ function plugin(fastify, opts, next) {
}

const fastifyRequestContextPlugin = fp(plugin, {
fastify: '3.x',
name: 'fastify-request-context',
fastify: '4.x',
name: '@fastify/request-context',
})

module.exports = {
Expand Down
8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@
"asynchronous-local-storage": "^1.0.2",
"fastify-plugin": "^3.0.0"
},
"peerDependencies": {
"fastify": "^3.0.0"
},
"devDependencies": {
"@types/node": "^17.0.0",
"eslint": "^8.1.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"fastify": "^3.22.1",
"fastify": "^4.0.0-rc.2",
"husky": "^8.0.1",
"jest": "^28.0.0",
"pinst": "^3.0.0",
Expand All @@ -45,9 +42,6 @@
"tsd": "^0.20.0",
"typescript": "4.6.4"
},
"engines": {
"node": ">=10.16.0"
},
"homepage": "http://github.com/fastify/fastify-request-context",
"repository": {
"type": "git",
Expand Down
12 changes: 6 additions & 6 deletions test-tap/requestContextPlugin.e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ test('correctly preserves values set in prevalidation phase within single POST r
}

app = initAppPostWithPrevalidation(route)
app.listen(0).then(() => {
app.listen({ port: 0, host: '127.0.0.1' }).then(() => {
testService = new TestService(app)
const { address, port } = app.server.address()
const url = `${address}:${port}`
const url = `http://${address}:${port}`
const response1Promise = request('POST', url)
.send({ requestId: 1 })
.then((response) => {
Expand Down Expand Up @@ -126,10 +126,10 @@ test('correctly preserves values set in multiple phases within single POST reque

app = initAppPostWithAllPlugins(route, 'preValidation')

app.listen(0).then(() => {
app.listen({ port: 0, host: '127.0.0.1' }).then(() => {
testService = new TestService(app)
const { address, port } = app.server.address()
const url = `${address}:${port}`
const url = `http://${address}:${port}`
const response1Promise = request('POST', url)
.send({ requestId: 1 })
.then((response) => {
Expand Down Expand Up @@ -181,9 +181,9 @@ test('correctly preserves values set in multiple phases within single POST reque

app = initAppPostWithAllPlugins(route)

return app.listen(0).then(() => {
return app.listen({ port: 0, host: '127.0.0.1' }).then(() => {
const { address, port } = app.server.address()
const url = `${address}:${port}`
const url = `http://${address}:${port}`
return request('POST', url)
.send({ requestId: 1 })
.then((response) => {
Expand Down
6 changes: 3 additions & 3 deletions test/requestContextPlugin.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('requestContextPlugin E2E', () => {
}

app = initAppPostWithPrevalidation(route)
app.listen(0).then(() => {
app.listen({ port: 0, host: '127.0.0.1' }).then(() => {
testService = new TestService(app)
const { address, port } = app.server.address()
const url = `${address}:${port}`
Expand Down Expand Up @@ -125,7 +125,7 @@ describe('requestContextPlugin E2E', () => {

app = initAppPostWithAllPlugins(route, 'preValidation')

app.listen(0).then(() => {
app.listen({ port: 0, host: '127.0.0.1' }).then(() => {
testService = new TestService(app)
const { address, port } = app.server.address()
const url = `${address}:${port}`
Expand Down Expand Up @@ -179,7 +179,7 @@ describe('requestContextPlugin E2E', () => {

app = initAppPostWithAllPlugins(route, 'onRequest')

return app.listen(0).then(() => {
return app.listen({ port: 0, host: '127.0.0.1' }).then(() => {
const { address, port } = app.server.address()
const url = `${address}:${port}`
return request('POST', url)
Expand Down