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

Function isGraphQLBody

packages/effect/src/graphql/GraphQLProtocol.ts:191–194  ·  view source on GitHub ↗
(body: unknown)

Source from the content-addressed store, hash-verified

189// A gateway's `{ "errors": "Throttled" }` is not a GraphQL response, so its
190// status and Retry-After still apply.
191const isGraphQLBody = (body: unknown): boolean =>
192 isObject(body) && ("data" in body || "errors" in body) &&
193 (!("errors" in body) || Array.isArray(body.errors)) &&
194 (!("data" in body) || body.data === null || isObject(body.data))
195
196// The JSON body of a POST and the payload of a graphql-ws `subscribe`.
197// `extensions` is dropped from the JSON when unset.

Callers 1

readResponseFunction · 0.85

Calls 1

isObjectFunction · 0.70

Tested by

no test coverage detected