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

OPTIONS stream request requires an empty body to finish successfully #2394

Open
2 tasks done
alexey-yarmosh opened this issue Dec 17, 2024 · 0 comments
Open
2 tasks done

Comments

@alexey-yarmosh
Copy link

Describe the bug

  • Node.js version: 22.12.0
  • OS & version: macOS 15.1.1

OPTIONS stream request requires body: '' to finish the request successfully.

const str = got.stream('https://www.jsdelivr.com', {
  "method": "OPTIONS",
  "body": '', // `RequestError: socket hang up` without that parameter.
});

Actual behavior

Either RequestError: socket hang up, or unnecessary body: '' should be passed.

Expected behavior

Should work fine without body: '' since OPTIONS request doesn't have body.

Code to reproduce

const str = got.stream('https://www.jsdelivr.com', {
  "method": "OPTIONS",
});

str.on('socket', () => { console.log('socket'); });

str.on('end', () => { console.log('end'); });

str.on('retry', (...args) => { console.log('retry', ...args); });

Checklist

  • I have read the documentation.
  • I have tried my code with the latest version of Node.js and Got.
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

No branches or pull requests

1 participant