Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Support for "Expect: 100-continue" #611

aseemk opened this Issue · 1 comment

3 participants


You probably already know what this is, but if not, a client can send an Expect: 100-continue request header, giving the server a chance to respond either with 100 Continue or a different, final status code, before the client sends along the request body.

E.g. Amazon S3 recommends using this:

Node supports this perfectly in core -- if it sees an Expect: 100-continue client request header, it'll send the headers right away, and emit a continue event if/when the server responds with 100 Continue.

If the server responds with something else, e.g. a redirect or an error, that's a regular response event. And for robustness, the caller should also set a timeout to go ahead send the request body if the server doesn't respond.

Usually, when sending Expect: 100-continue, you should both set a timeout and listen for the continue event.

Conceptually, supporting this is straightforward: if the request headers include Expect: 100-continue, don't write the request body right away, and instead set this listener and timeout.

var written = false;

function writeBody() {
  if (written) { return; }
  written = true;
  // write body here

req.on('continue', writeBody);
setTimeout(writeBody, 500);

But I know it might be trickier in practice with the details. =)

Hope this helps either way, and thanks for the consideration!


+1 would love to see this

@mikeal mikeal added the NeedsCode label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.