-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: harmonize diff function parameters
- Loading branch information
1 parent
7cd4a01
commit 28c970c
Showing
14 changed files
with
161 additions
and
113 deletions.
There are no files selected for viewing
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
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
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
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { DiffError } from '../@types'; | ||
import { checkValue } from './utils'; | ||
import { DIFF_SUBJECTS } from '../constants'; | ||
import { RequestInfo } from '../@types'; | ||
import { Route } from '../Route'; | ||
|
||
export function methodDiff(definition: string, value: string): DiffError[] { | ||
export function methodDiff(route: Route, request: RequestInfo): DiffError[] { | ||
return checkValue({ | ||
subject: DIFF_SUBJECTS.METHOD, | ||
definition: definition.toLowerCase(), | ||
value: value.toLowerCase(), | ||
definition: route.getMethod().toLowerCase(), | ||
value: request.method.toLowerCase(), | ||
path: '', | ||
}); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
import { DiffError, PathDefinition } from '../@types'; | ||
import { DiffError, RequestInfo } from '../@types'; | ||
import { checkValue } from './utils'; | ||
import { DIFF_SUBJECTS } from '../constants'; | ||
import { Route } from '../Route'; | ||
|
||
export function pathDiff( | ||
definition: PathDefinition, | ||
value: string, | ||
): DiffError[] { | ||
export function pathDiff(route: Route, request: RequestInfo): DiffError[] { | ||
return checkValue({ | ||
subject: DIFF_SUBJECTS.PATH, | ||
definition, | ||
value, | ||
definition: route.getPath(), | ||
value: request.path, | ||
path: '', | ||
}); | ||
} |
Oops, something went wrong.