-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: passing value null in post to type number throws type error (#516)
* fix: passing value null in post to type number throws type error * test: add regression tests
- Loading branch information
1 parent
6cd3e68
commit 090f871
Showing
6 changed files
with
231 additions
and
61 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
src/packages/router/route/params/errors/parameter-not-nullable-error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// @flow | ||
import { createServerError } from '../../../../server'; | ||
import type { ParameterLike } from '../index'; | ||
|
||
/** | ||
* @private | ||
*/ | ||
class ParameterNotNullableError extends TypeError { | ||
constructor({ path }: ParameterLike) { | ||
super(`Parameter '${path}' is not nullable.`); | ||
} | ||
} | ||
|
||
export default createServerError(ParameterNotNullableError, 400); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/packages/router/route/params/parameter/utils/validate-value.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
178 changes: 160 additions & 18 deletions
178
src/packages/router/route/params/test/parameter.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters