Skip to content

Commit 79f8b69

Browse files
Version Packages (#604)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent af1fcad commit 79f8b69

File tree

6 files changed

+49
-41
lines changed

6 files changed

+49
-41
lines changed

.changeset/metal-pants-act.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/witty-roses-begin.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

packages/effect-http-node/CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
# effect-http-node
22

3+
## 0.15.3
4+
5+
### Patch Changes
6+
7+
- [#606](https://github.com/sukovanej/effect-http/pull/606) [`af1fcad`](https://github.com/sukovanej/effect-http/commit/af1fcadebb6f57b7b7c2767998f344fcd7845895) Thanks [@sukovanej](https://github.com/sukovanej)! - Add `NodeTesting.handler`. It accepts a `Handler.Handler<A, E, R>` and produces an instance
8+
of `HttpClient.HttpClient.Default`. It start the server with the handler in a background
9+
and the produced client has base URL pointing to the server. It behaves exactly like the
10+
`NodeTesting.makeRaw`, but it works with handlers instead of `HttpApp.HttpApp` instances.
11+
12+
It provides a convenient way to test handlers in isolation.
13+
14+
```ts
15+
import { HttpClientRequest } from "@effect/platform";
16+
import { Schema } from "@effect/schema";
17+
import { expect, it } from "@effect/vitest";
18+
import { Effect } from "effect";
19+
import { Api, Handler } from "effect-http";
20+
import { NodeTesting } from "effect-http-node";
21+
22+
const myEndpoint = Api.get("myEndpoint", "/my-endpoint").pipe(
23+
Api.setResponseBody(Schema.Struct({ hello: Schema.String })),
24+
);
25+
26+
const myHandler = Handler.make(myEndpoint, () =>
27+
Effect.succeed({ hello: "world" }),
28+
);
29+
30+
it.scoped("myHandler", () =>
31+
Effect.gen(function* () {
32+
const client = yield* NodeTesting.handler(myHandler);
33+
const response = yield* client(HttpClientRequest.get("/my-endpoint"));
34+
35+
expect(response.status).toEqual(200);
36+
expect(yield* response.json).toEqual({ hello: "world" });
37+
}),
38+
);
39+
```
40+
41+
- Updated dependencies [[`6b388fa`](https://github.com/sukovanej/effect-http/commit/6b388faae43d121e5a58c739c2a9d78a108c656b)]:
42+
43+
344
## 0.15.2
445

546
### Patch Changes

packages/effect-http-node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "effect-http-node",
33
"type": "module",
4-
"version": "0.15.2",
4+
"version": "0.15.3",
55
"license": "MIT",
66
"author": "Milan Suk <[email protected]>",
77
"description": "High-level declarative HTTP API for effect-ts",

packages/effect-http/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# effect-http
22

3+
## 0.71.2
4+
5+
### Patch Changes
6+
7+
- [#603](https://github.com/sukovanej/effect-http/pull/603) [`6b388fa`](https://github.com/sukovanej/effect-http/commit/6b388faae43d121e5a58c739c2a9d78a108c656b) Thanks [@sukovanej](https://github.com/sukovanej)! - Improve error reporting of path string vs schema mismatch.
8+
39
## 0.71.1
410

511
### Patch Changes

packages/effect-http/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "effect-http",
33
"type": "module",
4-
"version": "0.71.1",
4+
"version": "0.71.2",
55
"license": "MIT",
66
"author": "Milan Suk <[email protected]>",
77
"description": "High-level declarative HTTP API for effect-ts",

0 commit comments

Comments
 (0)