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

Update for Fastify v5 #287

Merged
merged 7 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
test:
uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3
uses: fastify/workflows/.github/workflows/plugins-ci.yml@v4.1.0
with:
fastify-dependency-integration: true
license-check: true
Expand Down
2 changes: 1 addition & 1 deletion build/build-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const factory = AjvStandaloneCompiler({
readMode: false,
storeFunction (routeOpts, schemaValidationCode) {
const moduleCode = `// This file is autogenerated by ${__filename.replace(__dirname, 'build')}, do not edit
/* istanbul ignore file */
/* c8 ignore start */
/* eslint-disable */
${schemaValidationCode}
`
Expand Down
2 changes: 1 addition & 1 deletion lib/config-validator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is autogenerated by build/build-validation.js, do not edit
/* istanbul ignore file */
/* c8 ignore start */
/* eslint-disable */
"use strict";
module.exports = validate10;
Expand Down
6 changes: 2 additions & 4 deletions lib/form-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,13 @@ function formDataToStream (formdata) {
// header
yield textEncoder.encode(header)
// body
/* istanbul ignore else */
if (value.stream) {
yield * value.stream()
} else {
} /* c8 ignore start */ else {
// shouldn't be here since Blob / File should provide .stream
// and FormData always convert to USVString
/* istanbul ignore next */
yield value
}
} /* c8 ignore stop */
yield linebreak
}
}
Expand Down
8 changes: 6 additions & 2 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ const { isFormDataLike, formDataToStream } = require('./form-data')
const { EventEmitter } = require('node:events')

// request.connectin deprecation https://nodejs.org/api/http.html#http_request_connection
const FST_LIGHTMYREQUEST_DEP01 = createDeprecation({ name: 'FastifyDeprecationLightMyRequest', code: 'FST_LIGHTMYREQUEST_DEP01', message: 'You are accessing "request.connection", use "request.socket" instead.' })
const FST_LIGHTMYREQUEST_DEP01 = createDeprecation({
name: 'FastifyDeprecationLightMyRequest',
code: 'FST_LIGHTMYREQUEST_DEP01',
message: 'You are accessing "request.connection", use "request.socket" instead.'
})

/**
* Get hostname:port
Expand Down Expand Up @@ -182,7 +186,7 @@ function Request (options) {
}

const signal = options.signal
/* istanbul ignore if */
/* c8 ignore next 3 */
if (signal) {
addAbortSignal(signal, this)
}
Expand Down
2 changes: 1 addition & 1 deletion lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Response.prototype.addTrailers = function (trailers) {

function generatePayload (response) {
// This seems only to happen when using `fastify-express` - see https://github.com/fastify/fastify-express/issues/47
/* istanbul ignore if */
/* c8 ignore next 3 */
if (response._lightMyRequest.headers === null) {
copyHeaders(response)
}
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
"dependencies": {
"cookie": "^0.6.0",
"process-warning": "^3.0.0",
"set-cookie-parser": "^2.4.1"
"set-cookie-parser": "^2.6.0"
},
"devDependencies": {
"@fastify/ajv-compiler": "^3.1.0",
"@fastify/pre-commit": "^2.0.2",
"@types/node": "^20.1.0",
"@fastify/ajv-compiler": "^3.5.0",
"@fastify/pre-commit": "^2.1.0",
"@types/node": "^20.12.7",
"end-of-stream": "^1.4.4",
"express": "^4.17.1",
"form-auto-content": "^3.0.0",
"express": "^4.19.2",
"form-auto-content": "^3.2.1",
"form-data": "^4.0.0",
"formdata-node": "^4.4.1",
"standard": "^17.0.0",
"tap": "^16.0.0",
"tinybench": "^2.5.1",
"formdata-node": "^6.0.3",
"standard": "^17.1.0",
"tap": "^18.7.2",
"tinybench": "^2.7.0",
"tsd": "^0.31.0",
"undici": "^5.28.4"
"undici": "^6.13.0"
},
"scripts": {
"benchmark": "node benchmark/benchmark.js",
Expand Down