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

Function transformPayload

packages/effect/src/http-api/HttpApiEndpoint.ts:1744–1757  ·  view source on GitHub ↗
(schema: Schema.Top, method: HttpMethod)

Source from the content-addressed store, hash-verified

1742}
1743
1744function transformPayload(schema: Schema.Top, method: HttpMethod): Schema.Top {
1745 if (!hasBody(method)) return toCodecHttpProperties(schema)
1746 const encoding = HttpApiSchema.getPayloadEncoding(schema.ast, method)
1747 switch (encoding._tag) {
1748 case "Json":
1749 return Schema.toCodecJson(schema)
1750 case "FormUrlEncoded":
1751 return Schema.toCodecStringTree(schema)
1752 case "Text":
1753 case "Uint8Array":
1754 case "Multipart":
1755 return schema
1756 }
1757}
1758
1759/**
1760 * Creates a `GET` endpoint declaration.

Callers

nothing calls this directly

Calls 4

hasBodyFunction · 0.90
toCodecHttpPropertiesFunction · 0.90
toCodecJsonMethod · 0.65
toCodecStringTreeMethod · 0.65

Tested by

no test coverage detected