ruby on rails - httparty not working with localhost -


i making rails app contain apis , want controllers call apis instead of dealing activerecord.

i using httparty making calls. when following working fine.

response = httparty.get('https://google.com') 

but when try api call keeps on processing status browser sending request waited 15 minutes rendered nothing , saw rails console there no sign of request.

for api call using this:

response = httparty.get('http://localhost:3000/api/v1/score_sheets/9') 

even tried this:

response = httparty.get('http://0.0.0.0:3000/api/v1/score_sheets/9') 

and also:

response = httparty.get('http://127.0.0.1:3000/api/v1/score_sheets/9') 

making direct request through browser https://localhost:3000/api/v1/score_sheets/9 returns right json.

problem: wrong sending request localhost using method? or other possible way of doing this?

in development mode, 1 instance of app processes 1 request @ time (in production, of rails 4, thread safe mode enabled default depending on how app deployed may have no effect). more precisely, rack::lock middleware let's through 1 request @ time, affects below middleware

if request arrives while request still being processed must wait first 1 complete. in case results in code waiting ever: httparty request can complete when current request has completed, can happen when httparty request has completed.

there more 1 way deal this, example:

  • you run multiple instances of app (this easy tools such pow or passenger)
  • you split app 2 api provided separate app

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -