Skip to content

Commit 4fc5383

Browse files
chore: generate
1 parent d28b5ad commit 4fc5383

5 files changed

Lines changed: 27 additions & 13 deletions

File tree

packages/http-recorder/README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ const program = Effect.gen(function* () {
3434
Effect.runPromise(program.pipe(Effect.provide(HttpRecorder.cassetteLayer("users/get-one"))))
3535

3636
// Record. Hits the upstream and writes the cassette.
37-
Effect.runPromise(
38-
program.pipe(Effect.provide(HttpRecorder.cassetteLayer("users/get-one", { mode: "record" }))),
39-
)
37+
Effect.runPromise(program.pipe(Effect.provide(HttpRecorder.cassetteLayer("users/get-one", { mode: "record" }))))
4038
```
4139

4240
Set the mode from the environment in your test setup:
@@ -190,12 +188,12 @@ const audit = Effect.gen(function* () {
190188

191189
```ts
192190
type RecordReplayOptions = {
193-
mode?: "record" | "replay" | "passthrough" // default: "replay"
194-
directory?: string // default: <cwd>/test/fixtures/recordings
195-
metadata?: Record<string, unknown> // merged into cassette.metadata
196-
redactor?: Redactor // default: Redactor.defaults()
197-
dispatch?: "match" | "sequential" // default: "match"
198-
match?: (incoming, recorded) => boolean // custom matcher
191+
mode?: "record" | "replay" | "passthrough" // default: "replay"
192+
directory?: string // default: <cwd>/test/fixtures/recordings
193+
metadata?: Record<string, unknown> // merged into cassette.metadata
194+
redactor?: Redactor // default: Redactor.defaults()
195+
dispatch?: "match" | "sequential" // default: "match"
196+
match?: (incoming, recorded) => boolean // custom matcher
199197
}
200198
```
201199

packages/http-recorder/src/cassette.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,3 @@ export const layer = (options: { readonly directory?: string } = {}) =>
111111
return Service.of({ path: pathFor, read, write, append, exists, list, scan: cassetteSecretFindings })
112112
}),
113113
)
114-

packages/http-recorder/src/effect.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@ const decodeResponseBody = (snapshot: ResponseSnapshot) =>
4444
snapshot.bodyEncoding === "base64" ? Buffer.from(snapshot.body, "base64") : snapshot.body
4545

4646
export const redactedErrorRequest = (request: HttpClientRequest.HttpClientRequest) =>
47-
HttpClientRequest.makeWith(request.method, redactUrl(request.url), UrlParams.empty, Option.none(), Headers.empty, HttpBody.empty)
47+
HttpClientRequest.makeWith(
48+
request.method,
49+
redactUrl(request.url),
50+
UrlParams.empty,
51+
Option.none(),
52+
Headers.empty,
53+
HttpBody.empty,
54+
)
4855

4956
const transportError = (request: HttpClientRequest.HttpClientRequest, description: string) =>
5057
new HttpClientError.HttpClientError({

packages/http-recorder/src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
export type { CassetteMetadata, HttpInteraction, Interaction, RequestSnapshot, ResponseSnapshot, WebSocketFrame, WebSocketInteraction } from "./schema"
1+
export type {
2+
CassetteMetadata,
3+
HttpInteraction,
4+
Interaction,
5+
RequestSnapshot,
6+
ResponseSnapshot,
7+
WebSocketFrame,
8+
WebSocketInteraction,
9+
} from "./schema"
210
export { hasCassetteSync } from "./storage"
311
export { defaultMatcher, type RequestMatcher } from "./matching"
412
export { cassetteSecretFindings, redactHeaders, redactUrl, type SecretFinding } from "./redaction"

packages/http-recorder/src/recorder.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ export const makeReplayState = <T>(
5151
if (used === 0) return
5252
const interactions = yield* load.pipe(Effect.orDie)
5353
if (used < interactions.length)
54-
yield* Effect.die(new Error(`Unused recorded interactions in ${name}: used ${used} of ${interactions.length}`))
54+
yield* Effect.die(
55+
new Error(`Unused recorded interactions in ${name}: used ${used} of ${interactions.length}`),
56+
)
5557
}),
5658
)
5759

0 commit comments

Comments
 (0)