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

[node-compat] HttpsClientRequest.write() for a DELETE request #22565

Open
yasaichi opened this issue Feb 23, 2024 · 1 comment
Open

[node-compat] HttpsClientRequest.write() for a DELETE request #22565

yasaichi opened this issue Feb 23, 2024 · 1 comment
Labels
bug Something isn't working correctly node API polyfill Related to various "node:*" modules APIs node compat node:http Issues with `node:http` module - to be fixed with a rewrite

Comments

@yasaichi
Copy link

yasaichi commented Feb 23, 2024

When I was working around HTTP stuff with Deno, I found out that HttpsClientRequest.write() for a DELETE request is not compatible with the one of ClientRequest in Node.js. Here is the minimum code to reproduce the issue:

$ node
Welcome to Node.js v20.5.0.
Type ".help" for more information.
> require('https').request('https://reqres.in/api/users/2', { method: 'DELETE' }).write('42')
true
$ deno
Deno 1.40.5
exit using ctrl+d, ctrl+c, or close()
REPL is running with all permissions allowed.
To specify permissions, run `deno repl` with allow flags.
> (await import('node:https')).request('https://reqres.in/api/users/2', { method: 'DELETE' }).write('42')
Uncaught TypeError: Cannot read properties of undefined (reading 'write')
    at HttpsClientRequest._writeRaw (ext:deno_node/_http_outgoing.ts:422:24)
    at HttpsClientRequest._send (ext:deno_node/_http_outgoing.ts:408:17)
    at HttpsClientRequest.write_ (ext:deno_node/_http_outgoing.ts:316:16)
    at HttpsClientRequest.write (ext:deno_node/_http_outgoing.ts:293:17)
    at <anonymous>:3:4

By the way, I'm unsure whether this difference is intended because RFC 9110 says something like that a DELETE request should NOT have a body.

A client SHOULD NOT generate content in a DELETE request unless it is made directly to an origin server that has previously indicated
https://www.rfc-editor.org/rfc/rfc9110.html#name-delete

@yasaichi
Copy link
Author

yasaichi commented Mar 13, 2024

Are there any updates? This would help superagent and supertest (one of the most popular testing tools) work in Deno.

@bartlomieju bartlomieju added bug Something isn't working correctly node compat node API polyfill Related to various "node:*" modules APIs labels Mar 13, 2024
@bartlomieju bartlomieju added the node:http Issues with `node:http` module - to be fixed with a rewrite label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node API polyfill Related to various "node:*" modules APIs node compat node:http Issues with `node:http` module - to be fixed with a rewrite
Projects
None yet
Development

No branches or pull requests

2 participants