Skip to content

Commit

Permalink
Fixed fastify#3648 - URL must be a string
Browse files Browse the repository at this point in the history
  • Loading branch information
VigneshMurugan committed Jan 24, 2022
1 parent e437c29 commit 848c223
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/reply.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,11 @@ function handleError (reply, error, cb) {
const serializerFn = getSchemaSerializer(reply.context, statusCode)
payload = (serializerFn === false)
? serializeError({
error: statusCodes[statusCode + ''],
code: error.code,
message: error.message || '',
statusCode: statusCode
})
error: statusCodes[statusCode + ''],
code: error.code,
message: error.message || '',
statusCode: statusCode
})
: serializerFn(Object.create(error, {
error: { value: statusCodes[statusCode + ''] },
message: { value: error.message || '' },
Expand Down
2 changes: 2 additions & 0 deletions lib/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ function buildRouting (options) {
throw new Error(`Handler for ${method}:${url} route must be a function`)
}
}
} else if (url && typeof url !== 'string') {
throw new Error(`URL for method:${method} must be a string`)
}

options = Object.assign({}, options, {
Expand Down

0 comments on commit 848c223

Please sign in to comment.