(props: StatusCodeInfoProps)
| 86 | } |
| 87 | |
| 88 | export function StatusCodeInfo(props: StatusCodeInfoProps) { |
| 89 | const { statusCode } = props |
| 90 | |
| 91 | const statusColour = (code) => { |
| 92 | if (code >= 200 && code < 300) { |
| 93 | return 'green.400' |
| 94 | } else if (code >= 400 && code < 600) { |
| 95 | return 'red.400' |
| 96 | } |
| 97 | |
| 98 | return 'white' |
| 99 | } |
| 100 | |
| 101 | return ( |
| 102 | <Text fontFamily={'Inconsolata'}> |
| 103 | {statusCode ? ( |
| 104 | <> |
| 105 | <Text as="span" color={statusColour(statusCode)}> |
| 106 | {statusCode} |
| 107 | </Text> |
| 108 | {' | '} |
| 109 | {getReasonPhrase(statusCode)} |
| 110 | </> |
| 111 | ) : ( |
| 112 | <Text as="span" color={'gray.400'}> |
| 113 | Loading... |
| 114 | </Text> |
| 115 | )} |
| 116 | </Text> |
| 117 | ) |
| 118 | } |
| 119 | |
| 120 | export function BodyInfo(props: { body: string; rawContentType: string }) { |
| 121 | const { body, rawContentType } = props |
nothing calls this directly
no test coverage detected