MCPcopy Create free account
hub / github.com/Effect-TS/effect / inspect

Function inspect

packages/effect/src/unstable/http/HttpIncomingMessage.ts:125–152  ·  view source on GitHub ↗
(self: HttpIncomingMessage<E>, that: object)

Source from the content-addressed store, hash-verified

123 * @since 4.0.0
124 */
125export const inspect = <E>(self: HttpIncomingMessage<E>, that: object): object => {
126 const contentType = self.headers["content-type"] ?? ""
127 let body: unknown
128 if (contentType.includes("application/json")) {
129 try {
130 body = Effect.runSync(self.json)
131 // oxlint-disable-next-line @typescript-eslint/no-unused-vars
132 } catch (_) {
133 //
134 }
135 } else if (contentType.includes("text/") || contentType.includes("urlencoded")) {
136 try {
137 body = Effect.runSync(self.text)
138 // oxlint-disable-next-line @typescript-eslint/no-unused-vars
139 } catch (_) {
140 //
141 }
142 }
143 const obj: any = {
144 ...that,
145 headers: redact(self.headers),
146 remoteAddress: self.remoteAddress
147 }
148 if (body !== undefined) {
149 obj.body = body
150 }
151 return obj
152}

Callers 7

Option.test.tsFile · 0.85
Result.test.tsFile · 0.85
Chunk.test.tsFile · 0.85
BigDecimal.test.tsFile · 0.85
Duration.test.tsFile · 0.85
Trie.test.tsFile · 0.85

Calls 1

redactFunction · 0.90

Tested by

no test coverage detected