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

Function filterStatusOk

packages/effect/src/unstable/http/HttpClientResponse.ts:234–243  ·  view source on GitHub ↗
(self: HttpClientResponse)

Source from the content-addressed store, hash-verified

232 * @since 4.0.0
233 */
234export const filterStatusOk = (self: HttpClientResponse): Effect.Effect<HttpClientResponse, Error.HttpClientError> =>
235 self.status >= 200 && self.status < 300 ? Effect.succeed(self) : Effect.fail(
236 new Error.HttpClientError({
237 reason: new Error.StatusCodeError({
238 response: self,
239 request: self.request,
240 description: "non 2xx status code"
241 })
242 })
243 )
244
245// -----------------------------------------------------------------------------
246// internal

Callers

nothing calls this directly

Calls 2

succeedMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected