Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9045841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:27:44+00:00 2026-06-16T11:27:44+00:00

I have a scenario where I’m doing a post in Sinatra via Typhoeus in

  • 0

I have a scenario where I’m doing a post in Sinatra via Typhoeus in app.rb. It looks like this:

post "/send-data" do
  ...
  request = Typhoeus::Request.new("http://localhost:4000/renders",
                              :method         => :post,
                              :headers        => { :Accept => "text/html" },
                              :followlocation => true,
                              :timeout        => 100, # milliseconds
                              :params         => params )

  # Run the request via Hydra.
  hydra = Typhoeus::Hydra.new
  hydra.queue(request)
  hydra.run
  ...
end

When I post to ‘send-data’ Typhoeus successfully does it’s post and pushes the user to the view of the created record (http://localhost:4000/renders/34634646464), which is a rails app.

The problem is that the user is never redirected away from /send-data, so if you refresh the page it tries to do the post again. I guess this makes sense, but I really need the user to be redirected to the final (url) location of the record. In other words, the new record can be seen, but this method of redirecting does not actually move the user off of the sinatra app.

What would be the best way to handle this? The only one I can think of off the top of my head is to not use ‘followlocation’, but rather have the /send-data controller action do the redirect after getting the response location fron Typhoeus.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:27:46+00:00Added an answer on June 16, 2026 at 11:27 am

    I tried my suggestion and it works… and does not look too bad.

    request = Typhoeus::Request.new("http://localhost:4000/renders.json",
                                :method         => :post,
                                :headers        => { :Accept => "json" },
                                :timeout        => 100, # milliseconds
                                :params         => params )
    
    hydra = Typhoeus::Hydra.new
    hydra.queue(request)
    hydra.run
    
    response = request.response
    redirect response.headers_hash['Location']
    

    I did have to make a change on my rails server. The rails create action responds with json and ‘Location’ is it’s return value. ‘Location’is the location of where the newly created record resides. Then I just do a Sinatra redirect which will redirect to the new record on the rails app.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a scenario that looks like this: User A is a registered user.
I have scenario like this Given /^initial data$/ do |table| @schedule_05 = Factory.build :schedule_05
let me ask you something, if a have scenario like this: Scenario: Listing the
I have a scenario like this in ssis - I have got two different
I have scenario like this: public void processData(String name,String value) { /* line 1
I have this scenario well, i'll let the model explain. public class ScheduleMonthlyPerDayModel {
I have the scenario where the data from a single table must be in
I have a scenario whereby I am needing to display some fairly simple data
I have this scenario. Where i am writing one apps in Android usging bash/python.
i have scenario where i have to do the batch update like in save

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.