-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix #236 DELETE should set Content-Length to 0 #711
Conversation
@@ -0,0 +1,21 @@ | |||
var EventEmitter = require('events').EventEmitter | |||
, request = require('../../') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please follow existing style for source files/vars
request.del('http://localhost:3005/nonexistant') | ||
.end(function(err, res) { | ||
assert(err) | ||
res.request.req._headers['content-length'].should.equal(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a better way to check the header that has been sent?
@soyuka the |
@defunctzombie nope, the browser should set the Could you check out my last comment : #711 (comment) ? Thanks. |
Bump |
As far as I know HTTP RFC does not forbid DELETE requests to have a body (even GET requests can have one!), so forcing 0-length body wouldn't be appropriate. Sorry @soyuka. That's a well-written pull request, but I think it's not a behavior the library should have. |
@pornel maybe that was the cause:
https://tools.ietf.org/html/rfc7231 Thanks for the answer. Anyway, I'm almost always extending supertest/superagent for my needs. I can provide an example if someone wants. You may want to close #236 too. |
That clause is for OPTIONS (in that case I wouldn't be opposed to setting content-length if nodejs doesn't do that already). For DELETE I see:
|
No description provided.