Skip to content
8 changes: 4 additions & 4 deletions packages/adapters/fastify/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
"test:watch": "vitest watch"
},
"dependencies": {
"@fastify/http-proxy": "9.5.0",
"@fastify/static": "6.12.0",
"@fastify/url-data": "5.4.0",
"@fastify/http-proxy": "11.1.2",
"@fastify/static": "8.2.0",
"@fastify/url-data": "6.0.3",
"@redwoodjs/project-config": "workspace:*",
"fast-glob": "3.3.2"
},
"devDependencies": {
"@redwoodjs/framework-tools": "workspace:*",
"fastify": "4.28.1",
"fastify": "5.3.3",
"tsx": "4.19.2",
"typescript": "5.6.2",
"vitest": "2.1.9"
Expand Down
20 changes: 10 additions & 10 deletions packages/adapters/fastify/web/src/web.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('redwoodFastifyWeb', () => {
})

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/html; charset=UTF-8')
expect(res.headers['content-type']).toBe('text/html; charset=utf-8')
expect(res.body).toBe(
fs.readFileSync(path.join(getPaths().web.dist, `${url}.html`), 'utf-8'),
)
Expand All @@ -66,7 +66,7 @@ describe('redwoodFastifyWeb', () => {
})

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/html; charset=UTF-8')
expect(res.headers['content-type']).toBe('text/html; charset=utf-8')
expect(res.body).toBe(
fs.readFileSync(path.join(getPaths().web.dist, `${url}.html`), 'utf-8'),
)
Expand All @@ -83,7 +83,7 @@ describe('redwoodFastifyWeb', () => {
})

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/html; charset=UTF-8')
expect(res.headers['content-type']).toBe('text/html; charset=utf-8')
expect(res.body).toBe(
fs.readFileSync(path.join(getPaths().web.dist, `${url}.html`), 'utf-8'),
)
Expand Down Expand Up @@ -122,7 +122,7 @@ describe('redwoodFastifyWeb', () => {
})

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/html; charset=UTF-8')
expect(res.headers['content-type']).toBe('text/html; charset=utf-8')
expect(res.body).toBe(
fs.readFileSync(path.join(getPaths().web.dist, url), 'utf-8'),
)
Expand All @@ -135,7 +135,7 @@ describe('redwoodFastifyWeb', () => {
})

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/html; charset=UTF-8')
expect(res.headers['content-type']).toBe('text/html; charset=utf-8')
expect(res.body).toBe(
fs.readFileSync(path.join(getPaths().web.dist, '200.html'), 'utf-8'),
)
Expand All @@ -153,7 +153,7 @@ describe('redwoodFastifyWeb', () => {

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe(
'application/javascript; charset=UTF-8',
'application/javascript; charset=utf-8',
)
expect(res.body).toBe(
fs.readFileSync(
Expand All @@ -172,7 +172,7 @@ describe('redwoodFastifyWeb', () => {
})

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/css; charset=UTF-8')
expect(res.headers['content-type']).toBe('text/css; charset=utf-8')
expect(res.body).toBe(
fs.readFileSync(
path.join(getPaths().web.dist, relativeFilePath),
Expand All @@ -191,7 +191,7 @@ describe('redwoodFastifyWeb', () => {

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe(
'application/json; charset=UTF-8',
'application/json; charset=utf-8',
)
expect(res.body).toBe(
fs.readFileSync(
Expand Down Expand Up @@ -220,7 +220,7 @@ describe('redwoodFastifyWeb', () => {
})

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/markdown; charset=UTF-8')
expect(res.headers['content-type']).toBe('text/markdown; charset=utf-8')
expect(res.body).toBe(
fs.readFileSync(
path.join(getPaths().web.dist, relativeFilePath),
Expand All @@ -238,7 +238,7 @@ describe('redwoodFastifyWeb', () => {
})

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/plain; charset=UTF-8')
expect(res.headers['content-type']).toBe('text/plain; charset=utf-8')
expect(res.body).toBe(
fs.readFileSync(
path.join(getPaths().web.dist, relativeFilePath),
Expand Down
2 changes: 1 addition & 1 deletion packages/adapters/fastify/web/src/webFallback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('webFallback', () => {
})

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/html; charset=UTF-8')
expect(res.headers['content-type']).toBe('text/html; charset=utf-8')
expect(res.body).toBe(
fs.readFileSync(path.join(getPaths().web.dist, url), 'utf-8'),
)
Expand Down
9 changes: 5 additions & 4 deletions packages/api-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"test:watch": "vitest watch"
},
"dependencies": {
"@fastify/multipart": "8.3.1",
"@fastify/url-data": "5.4.0",
"@fastify/multipart": "9.0.3",
"@fastify/url-data": "6.0.3",
"@redwoodjs/context": "workspace:*",
"@redwoodjs/fastify-web": "workspace:*",
"@redwoodjs/internal": "workspace:*",
Expand All @@ -41,8 +41,8 @@
"dotenv-defaults": "5.0.2",
"fast-glob": "3.3.2",
"fast-json-parse": "1.0.3",
"fastify": "4.28.1",
"fastify-raw-body": "4.3.0",
"fastify": "5.3.3",
"fastify-raw-body": "5.0.0",
"lodash": "4.17.21",
"pretty-bytes": "5.6.0",
"pretty-ms": "7.0.1",
Expand All @@ -57,6 +57,7 @@
"@types/qs": "6.9.16",
"@types/split2": "4.2.3",
"@types/yargs": "17.0.33",
"memfs": "4.14.0",
"pino-abstract-transport": "1.2.0",
"tsx": "4.19.2",
"typescript": "5.6.2",
Expand Down
21 changes: 9 additions & 12 deletions packages/api-server/src/__tests__/createServer.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path'

import pino from 'pino'
import pino from 'pino/pino'
import build from 'pino-abstract-transport'
import {
vi,
Expand All @@ -19,7 +19,7 @@ import type { createServer as tCreateServer } from '../createServer.js'
import type { ResolvedOptions } from '../createServerHelpers'
import {
resolveOptions,
DEFAULT_CREATE_SERVER_OPTIONS,
getDefaultCreateServerOptions,
} from '../createServerHelpers'

// Set up RWJS_CWD.
Expand Down Expand Up @@ -161,7 +161,6 @@ describe('createServer', () => {
level: 30,
msg: 'incoming request',
req: {
hostname: 'localhost:80',
method: 'GET',
remoteAddress: '127.0.0.1',
url: '/hello',
Expand Down Expand Up @@ -226,18 +225,16 @@ describe('createServer', () => {
describe('resolveOptions', () => {
it('nothing passed', () => {
const resolvedOptions = resolveOptions()
const defaults = getDefaultCreateServerOptions()

expect(resolvedOptions).toEqual({
apiRootPath: DEFAULT_CREATE_SERVER_OPTIONS.apiRootPath,
configureApiServer: DEFAULT_CREATE_SERVER_OPTIONS.configureApiServer,
apiRootPath: defaults.apiRootPath,
configureApiServer: defaults.configureApiServer,
fastifyServerOptions: {
requestTimeout:
DEFAULT_CREATE_SERVER_OPTIONS.fastifyServerOptions.requestTimeout,
logger: DEFAULT_CREATE_SERVER_OPTIONS.logger,
bodyLimit: DEFAULT_CREATE_SERVER_OPTIONS.fastifyServerOptions.bodyLimit,
requestTimeout: defaults.fastifyServerOptions.requestTimeout,
logger: defaults.logger,
bodyLimit: defaults.fastifyServerOptions.bodyLimit,
},
discoverFunctionsGlob:
DEFAULT_CREATE_SERVER_OPTIONS.discoverFunctionsGlob,
apiPort: 65501,
apiHost: '::',
} as ResolvedOptions)
Expand Down Expand Up @@ -303,7 +300,7 @@ describe('resolveOptions', () => {

expect(resolvedOptions).toMatchObject({
fastifyServerOptions: {
logger: DEFAULT_CREATE_SERVER_OPTIONS.logger,
logger: getDefaultCreateServerOptions().logger,
},
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/api-server/src/__tests__/fastify.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fastify from 'fastify'
import fastify from 'fastify/fastify'
import { vol } from 'memfs'
import {
vi,
Expand Down
6 changes: 2 additions & 4 deletions packages/api-server/src/createServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import path from 'path'
import chalk from 'chalk'
import { config } from 'dotenv-defaults'
import fg from 'fast-glob'
import fastify from 'fastify'
import fastify from 'fastify/fastify'

import type { GlobalContext } from '@redwoodjs/context'
import type { GlobalContext } from '@redwoodjs/context/dist'
import { getAsyncStoreInstance } from '@redwoodjs/context/dist/store'
import { getConfig, getPaths } from '@redwoodjs/project-config'

Expand Down Expand Up @@ -67,7 +67,6 @@ export async function createServer(options: CreateServerOptions = {}) {
const {
apiRootPath,
fastifyServerOptions,
discoverFunctionsGlob,
configureApiServer,
apiPort,
apiHost,
Expand Down Expand Up @@ -120,7 +119,6 @@ export async function createServer(options: CreateServerOptions = {}) {
fastGlobOptions: {
ignore: ['**/dist/functions/graphql.js'],
},
discoverFunctionsGlob,
configureServer: configureApiServer,
},
})
Expand Down
Loading
Loading