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

How to keep POST alive until .end()? #1547

Closed
ronag opened this issue Apr 19, 2015 · 3 comments
Closed

How to keep POST alive until .end()? #1547

ronag opened this issue Apr 19, 2015 · 3 comments
Labels

Comments

@ronag
Copy link

ronag commented Apr 19, 2015

The following code does not work since the server closes the 'upload' request before it started uploading data.

_(process.stdin)
  .split()
  .filter(id => id)
  .map(id => _([id])
    .through(request.post(`${process.env.HOST}/download`))
    .through(ops[op])
    .through(request.post(`${process.env.HOST}/upload`))) // write after end :(
  .sequence()
  .pipe(process.stdout)
REQUEST make request http://localhost:8080/upload
REQUEST onRequestResponse http://localhost:8080/upload 200 { 'x-powered-by': 'Express',
  date: 'Sun, 19 Apr 2015 14:42:42 GMT',
  connection: 'close',
  'transfer-encoding': 'chunked' }
REQUEST finish init function http://localhost:8080/upload
REQUEST response end http://localhost:8080/upload 200 { 'x-powered-by': 'Express',
  date: 'Sun, 19 Apr 2015 14:42:42 GMT',
  connection: 'close',
  'transfer-encoding': 'chunked' }
REQUEST onRequestResponse http://localhost:8080/download 200 { 'x-powered-by': 'Express',
  date: 'Sun, 19 Apr 2015 14:42:42 GMT',
  connection: 'close',
  'transfer-encoding': 'chunked' }
REQUEST finish init function http://localhost:8080/download
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: write after end
    at ClientRequest.OutgoingMessage.write (_http_outgoing.js:413:15)

How do I make it so that the post request stays alive until .end() is called on the stream object?

@odnarb
Copy link

odnarb commented May 7, 2015

Are you attempting something like this?: #401

@odnarb
Copy link

odnarb commented Mar 9, 2016

Check this post for a possible solution #401 (comment)

@stale
Copy link

stale bot commented Nov 23, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 23, 2018
@stale stale bot closed this as completed Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants