Skip to content

should throw for non-string route URL #3648

@Eomm

Description

@Eomm

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

This snippet starts correctly:

const fastify = require('fastify')({ logger: true })

const handler = async (request, reply) => {
  return { hello: request.params.foo }
}

fastify.get(/^\/(donations|skills|blogs)/, handler)
fastify.listen(8080)

There is one error: the regExp on the route's URL.
In this case, I think we should throw an error.

Note that find-my-way is receiving a string because we are composing its route input checking the prefix etc..

Do you agree?

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerssemver-minorIssue or PR that should land as semver minor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions