Home Is there opportunity to debug http request in RubyMine?
Reply: 1

Is there opportunity to debug http request in RubyMine?

user2267897 Published in 2018-01-12 12:47:21Z

Appear problem when I try to debug http response with default Ruby lib Net::HTTP

Example. I have such piece of code

url = URI.parse("http://nibbler.silktide.com/") # any http resource

req = Net::HTTP.get_response(url) # the same situation with get method of the Net::HTTP module

p req

I set breakpoint on the second line and try to execute it in the Interactive console and got "Timeout: evaluation took longer than 10 seconds."

But when I set breakpoint on the third line (or press F8 to make Step Over) I got correct value in req => #<Net::HTTPOK 200 OK readbody=true>

Why such situation appear? In such way I can't debug response in my code. Could anybody help me?


OS - Ubuntu 16.04 x64

RubyMine version - 2017.2.4

Ruby version - 2.4.2p198

ruby-debug-ide (0.6.1.beta10)

Thank you in advance

s1mpl3 Reply to 2018-01-18 15:32:59Z

When you set up the break point in the second line the request has not been submitted yet. Set the break point in the third line and then open the "Evaluate Expression" window to run


Or set them up as in the watches frame

Edit to respond to comment: If you evaluate req you get nil because it the request hasn't been submitted. If you copy paste and try to execute the entire line then you get the timeout message. The debugger has a single thread analyzing the http requests this way. In any case to "debug the http request" as you ask you need to place the breakpoint after the request has been submitted.

I hope this helps.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.322584 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO