MCPcopy Create free account
hub / github.com/SplootCode/splootcode / StatusCodeInfo

Function StatusCodeInfo

packages/editor/src/runtime/response_viewer.tsx:88–118  ·  view source on GitHub ↗
(props: StatusCodeInfoProps)

Source from the content-addressed store, hash-verified

86}
87
88export 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
120export function BodyInfo(props: { body: string; rawContentType: string }) {
121 const { body, rawContentType } = props

Callers

nothing calls this directly

Calls 1

statusColourFunction · 0.85

Tested by

no test coverage detected