You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The 100 HTTP status code needs special handling, because the server will do a first validation and send a response, then the client will send the rest of the response. It can be used when the client wants to send a huge file but check authorization before sending the actual data.
consthttp=require('http');constnet=require('net');consturl=require('url');constserver=http.createServer()// listen for checkContinue eventsserver.on('checkContinue',function(req,res){console.log("check_continue")req.checkContinue=true;handlePostFile(req,res);// call express directly to route the request});// example request handlerfunctionhandlePostFile(req,res){console.log("handle post file")// was this a conditional request?if(req.checkContinue===true){req.checkContinue=false;// send 100 Continue responseres.writeContinue();console.log("wrote continue");// client will now send us the request body}// collect request bodyvarbody='';req.once('readable',function(){varchunk;console.log("readable()");while((chunk=req.read())!==null){console.log("read");body+=chunk;}// do something with request body});}server.listen(1029)
The text was updated successfully, but these errors were encountered:
A WIP was made in 52fec49
For now, we only assert that we got a HTTP 200 status code on the second response.
The current HTTP client doesn't support multiple responses (100-continue) for a request. We have to find a HTTP client which support that and provide an API to make an assert on status code.
The 100 HTTP status code needs special handling, because the server will do a first validation and send a response, then the client will send the rest of the response. It can be used when the client wants to send a huge file but check authorization before sending the actual data.
References:
https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.1.1
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/100
example server code:
The text was updated successfully, but these errors were encountered: