Why Net: HTTP / HTTParty Causes Watir-Webdriver Script / Net :: ReadTimeout Error Interrupt

I installed the Watir-Webdriver script, which I want to tell the remote service:

puts "Starting..." b = Watir::Browser.new :ie puts "Started browser" puts "Setting status as non-idle" request = Net::HTTP::Post.new() url = URI(HOME + '/update_status') request.body = JSON.generate({ scrapeId: SCRAPE_ID, status: 'working' }) # This step freezes processing Net::HTTP.start(url.host, url.port) {|http| http.request(request)} puts "This step never happens" 

At the same time, node.js / express watir sends pinging, has the following endpoint:

 app.post('/update_status', function(req, res) { redis.hset(req.body.scrapeId, 'status', req.body.status); if (req.body.status === 'finished') { redis.expire(req.body.scrapeId, SIX_HOURS); } res.send('response from post /update_status'); }); 

Question: Why is Net :: HTTP disconnected when /update_status ? Interestingly, if the server returns 404 (the endpoint does not exist), the Watir script continues normally.

Net::ReadTimeout is obviously a culture, but why?

+5
source share
1 answer

“Assumption is the mother of all problems” - to paraphrase some very smart guy or girl.

The answer was as simple as stupid - I added the node.js middleware, dropping next(); . Nothing wrong with the script, as it turned out, I was looking for the wrong place and not experiencing this. Oops

+2
source

Source: https://habr.com/ru/post/1240785/


All Articles