Skip to content

@Param only accepts numbers #347

Closed
Closed
@ghost

Description

I'm trying to use a route like this: @delete('/account/:apiKey')

The apiKeys are strings and not numbers. If I try to hit the endpoint with a string I get a bad request (500) error:

Error
at ParameterParseJsonError.HttpError [as constructor] (/myProjectDirectory/src/http-error/HttpError.ts:19:22)
at ParameterParseJsonError.BadRequestError [as constructor] (/myProjectDirectory/src/http-error/BadRequestError.ts:10:9)
at new ParameterParseJsonError (/myProjectDirectory/src/error/ParameterParseJsonError.ts:10:9)
at ActionParameterHandler.parseValue (/myProjectDirectory/src/ActionParameterHandler.ts:153:23)
at ActionParameterHandler.normalizeParamValue (/myProjectDirectory/src/ActionParameterHandler.ts:137:34)
at ActionParameterHandler.handle (/myProjectDirectory/src/ActionParameterHandler.ts:44:28)
at /myProjectDirectory/src/RoutingControllers.ts:116:49
at Array.map ()
at RoutingControllers.executeAction (/myProjectDirectory/src/RoutingControllers.ts:116:14)
at /myProjectDirectory/src/RoutingControllers.ts:83:33

If I use a number, I get my own defined 404 custom error as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions