github Effect-TS/effect @effect/platform-browser@0.31.16

latest releases: @effect/sql-sqlite-wasm@0.11.5, @effect/sql-sqlite-react-native@0.14.5, @effect/sql-sqlite-node@0.12.5...
5 months ago

Patch Changes

  • #2387 75a8d16 Thanks @tim-smart! - add Cookies module to /platform http

    To add cookies to a http response:

    import * as Http from "@effect/platform/HttpServer";
    
    Http.response.empty().pipe(
      Http.response.setCookies([
        ["name", "value"],
        ["foo", "bar", { httpOnly: true }],
      ]),
    );

    You can also use cookies with the http client:

    import * as Http from "@effect/platform/HttpClient";
    import { Effect, Ref } from "effect";
    
    Effect.gen(function* (_) {
      const ref = yield* _(Ref.make(Http.cookies.empty));
      const defaultClient = yield* _(Http.client.Client);
      const clientWithCookies = defaultClient.pipe(
        Http.client.withCookiesRef(ref),
        Http.client.filterStatusOk,
      );
    
      // cookies will be stored in the ref and sent in any subsequent requests
      yield* _(
        Http.request.get("https://www.google.com/"),
        clientWithCookies,
        Effect.scoped,
      );
    });
  • #2385 3307729 Thanks @tim-smart! - update typescript to 5.4

  • Updated dependencies [75a8d16, 3307729]:

    • @effect/platform@0.48.16
    • effect@2.4.12

Don't miss a new effect release

NewReleases is sending notifications on new releases.