Skip to content

fix(http): support browser File attachments#1021

Open
cerredz wants to merge 1 commit into
cyclejs:masterfrom
cerredz:issuehunt-294-browser-file-attach
Open

fix(http): support browser File attachments#1021
cerredz wants to merge 1 commit into
cyclejs:masterfrom
cerredz:issuehunt-294-browser-file-attach

Conversation

@cerredz
Copy link
Copy Markdown

@cerredz cerredz commented May 16, 2026

Fixes #294.

The HTTP driver previously assumed every attach entry used the Node-style { name, path, filename } shape, which breaks for browser File objects from <input type=file> because those objects have no path or filename property.

This keeps the existing Node path behavior and adds browser-only handling for:

  • attach: [file]
  • attach: [{ name: 'file', file, filename: 'hello.txt' }]

Node behavior is guarded so Node 22's global File does not accidentally take the browser path when using Node superagent.

Verification:

  • npm run lint --prefix http
  • npx tsc --project http\\tsconfig.json --module commonjs --outDir http\\lib\\cjs
  • npx tsc --project http\\tsconfig.json --module es6 --outDir http\\lib\\es6
  • npm run test-node --prefix http (26 passing, 2 browser-only tests pending in Node)
  • ChromeHeadless karma start http/karma.conf.js --browsers ChromeHeadless --single-run with the HTTP support server running (28/28 passing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP: attach for file uploads does not work in the browser

1 participant