Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support server-sent events (SSE) #2299

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
daec32b
feat: support server-sent events
kettanaito Sep 30, 2024
8c37fe0
fix: support passthrough via `server`
kettanaito Sep 30, 2024
7075686
fix: prevent double data serialization
kettanaito Sep 30, 2024
775c2d6
chore: rename sse test
kettanaito Sep 30, 2024
c53e13e
fix: make forwarding manual
kettanaito Oct 1, 2024
2edf2a6
chore: use node v20 for ci
kettanaito Oct 1, 2024
81cc17e
test: add "withCredentials" test
kettanaito Oct 1, 2024
1226612
fix: throw if EventSource is undefined
kettanaito Oct 1, 2024
4c49a14
feat: support `EventMap` type argument
kettanaito Oct 1, 2024
4471412
feat: support server-to-client forwarding
kettanaito Oct 2, 2024
3fdf314
test(axios-upload): wrap request promise in expect
kettanaito Oct 4, 2024
b11ba9b
fix: skip stringifying non-objects
kettanaito Oct 4, 2024
852870a
test: add runtime request handler test
kettanaito Oct 4, 2024
4d6ccfe
chore: use v22 for ci only
kettanaito Oct 4, 2024
8afa887
test: improve axios errors in test
kettanaito Oct 4, 2024
bbc4553
fix: fail connection on fetch failure
kettanaito Oct 10, 2024
2afd608
fix: prevent dispatching message if data is empty
kettanaito Oct 10, 2024
3402738
Merge branch 'main' into feat/sse
kettanaito Oct 13, 2024
8130892
Merge branch 'main' into feat/sse
kettanaito Nov 16, 2024
66098c3
Merge branch 'main' into feat/sse
kettanaito Feb 11, 2025
913f4c7
chore: update @playwright/test
kettanaito Feb 11, 2025
665560e
chore: fix type tests
kettanaito Feb 11, 2025
1960ee2
chore: remove NODE_OPTIONS from browser test args
kettanaito Feb 11, 2025
02e3335
Merge branch 'main' into feat/sse
kettanaito Feb 20, 2025
e0ba1eb
fix: set `accept` for bypassing the request
kettanaito Feb 20, 2025
e968886
test: fix promise return types
kettanaito Feb 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: improve axios errors in test
  • Loading branch information
kettanaito committed Oct 4, 2024
commit 8afa887b63086edaea0e15e3862c657d43022cc5
12 changes: 7 additions & 5 deletions test/node/third-party/axios-upload.node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

const server = setupServer(
http.post('https://example.com/upload', async ({ request }) => {
const data = await request.formData()

Check failure on line 9 in test/node/third-party/axios-upload.node.test.ts

View workflow job for this annotation

GitHub Actions / build

test/node/third-party/axios-upload.node.test.ts > responds with a mocked response to an upload request

TypeError: Failed to parse body as FormData. ❯ test/node/third-party/axios-upload.node.test.ts:9:18 ❯ src/core/handlers/RequestHandler.ts:322:24 ❯ HttpHandler.run src/core/handlers/RequestHandler.ts:303:28 ❯ Module.executeHandlers src/core/utils/executeHandlers.ts:36:14 ❯ Module.until node_modules/.pnpm/@open-draft[email protected]/node_modules/@open-draft/until/src/until.ts:23:18
const file = data.get('file')

if (!file) {
Expand Down Expand Up @@ -45,11 +45,13 @@
const file = new Blob(['Hello', 'world'], { type: 'text/plain' })
formData.set('file', file, 'doc.txt')

await expect(request.post('/upload', formData)).resolves.toMatchObject({
data: {
message: 'Successfully uploaded "doc.txt"!',
content: 'Helloworld',
},
const response = await request.post('/upload', formData).catch((error) => {
throw error.response.data
})

expect(response.data).toEqual({
message: 'Successfully uploaded "doc.txt"!',
content: 'Helloworld',
})

expect(onUploadProgress.mock.calls.length).toBeGreaterThan(0)
Expand Down
Loading