MCPcopy
hub / github.com/Effect-TS/effect / inspect

Function inspect

packages/platform/src/HttpIncomingMessage.ts:103–128  ·  view source on GitHub ↗
(self: HttpIncomingMessage<E>, that: object)

Source from the content-addressed store, hash-verified

101 * @since 1.0.0
102 */
103export const inspect = <E>(self: HttpIncomingMessage<E>, that: object): object => {
104 const contentType = self.headers["content-type"] ?? ""
105 let body: unknown
106 if (contentType.includes("application/json")) {
107 try {
108 body = Effect.runSync(self.json)
109 } catch {
110 //
111 }
112 } else if (contentType.includes("text/") || contentType.includes("urlencoded")) {
113 try {
114 body = Effect.runSync(self.text)
115 } catch {
116 //
117 }
118 }
119 const obj: any = {
120 ...that,
121 headers: Inspectable.redact(self.headers),
122 remoteAddress: self.remoteAddress.toJSON()
123 }
124 if (body !== undefined) {
125 obj.body = body
126 }
127 return obj
128}

Callers 15

Either.test.tsFile · 0.85
MutableRef.test.tsFile · 0.85
Option.test.tsFile · 0.85
Chunk.test.tsFile · 0.85
HashMap.test.tsFile · 0.85
BigDecimal.test.tsFile · 0.85
SortedMap.test.tsFile · 0.85
HashSet.test.tsFile · 0.85
Cause.test.tsFile · 0.85

Calls 1

toJSONMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…