feat(sdk): restore session runtime operations (#33777)
This commit is contained in:
parent
44806777ca
commit
f44423609b
20 changed files with 1099 additions and 92 deletions
|
|
@ -395,7 +395,9 @@ describe("HttpApiCodegen.generate", () => {
|
|||
api(
|
||||
HttpApiEndpoint.get("subscribe", "/event", {
|
||||
query: { after: Schema.optional(Schema.Number) },
|
||||
success: HttpApiSchema.StreamSse({ data: Schema.Struct({ type: Schema.String }) }),
|
||||
success: HttpApiSchema.StreamSse({
|
||||
data: Schema.Struct({ type: Schema.String, count: Schema.NumberFromString }),
|
||||
}),
|
||||
}),
|
||||
),
|
||||
),
|
||||
|
|
@ -416,7 +418,7 @@ describe("HttpApiCodegen.generate", () => {
|
|||
return new Response(
|
||||
new ReadableStream({
|
||||
start(controller) {
|
||||
controller.enqueue(encoder.encode('data: {"type":"ready"}\r'))
|
||||
controller.enqueue(encoder.encode('data: {"type":"ready","count":"1"}\r'))
|
||||
controller.enqueue(encoder.encode("\n\r\n"))
|
||||
controller.close()
|
||||
},
|
||||
|
|
@ -430,7 +432,7 @@ describe("HttpApiCodegen.generate", () => {
|
|||
expect(requests).toBe(0)
|
||||
const received = []
|
||||
for await (const event of events) received.push(event)
|
||||
expect(received).toEqual([{ type: "ready" }])
|
||||
expect(received).toEqual([{ type: "ready", count: "1" }])
|
||||
expect(requests).toBe(1)
|
||||
expect(url).toBe("https://example.com/event?after=2")
|
||||
} finally {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue