Skip to content

Commit ae697a8

Browse files
committed
Chore(added HEAD and OPTIONS method to the color function)
1 parent 94b90b7 commit ae697a8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

packages/logger-middleware/src/lib/colors.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ function colorizeDuration(value: string, duration?: number): string {
4848
return `${GREEN}${value}${RESET}`
4949
}
5050

51-
function colorizeContentLength(value: string, length?: number): string {
52-
const ONE_MB = 1024 * 1024
53-
const ONE_HUNDRED_KB = 100 * 1024
54-
const ONE_KB = 1024
51+
const ONE_MB = 1024 * 1024
52+
const ONE_HUNDRED_KB = 100 * 1024
53+
const ONE_KB = 1024
5554

55+
function colorizeContentLength(value: string, length?: number): string {
5656
if (length === undefined) return value
5757
if (length >= ONE_MB) return `${RED}${value}${RESET}`
5858
if (length >= ONE_HUNDRED_KB) return `${YELLOW}${value}${RESET}`
@@ -67,11 +67,13 @@ function colorizeMethod(value: string): string {
6767
case 'POST':
6868
return `${CYAN}${value}${RESET}`
6969
case 'PUT':
70-
return `${YELLOW}${value}${RESET}`
7170
case 'PATCH':
72-
return `${MAGENTA}${value}${RESET}`
71+
return `${YELLOW}${value}${RESET}`
7372
case 'DELETE':
7473
return `${RED}${value}${RESET}`
74+
case 'HEAD':
75+
case 'OPTIONS':
76+
return `${MAGENTA}${value}${RESET}`
7577
default:
7678
return value
7779
}

0 commit comments

Comments
 (0)