in reply to Re^3: Dancer::send_file only for POST?
in thread Solved: Dancer::send_file doesn't work with POST? ( Angular JS hijacks the response)
Hi Corion, apologies, it is 0500 and I was posting on phone. Back at PC now.
This is a Dancer app running nicely with starman.
This code results in the browser downloading a CSV file:
While this code results in nothing: no error in the log, no content returned to browser:get '/test/csv' => sub { my $csv = "foo, bar, baz"; send_file( \$csv, content_type => 'text/csv', filename => 'qux.csv +' ); };
post '/test/csv' => sub { my $csv = "foo, bar, baz"; send_file( \$csv, content_type => 'text/csv', filename => 'qux.csv +' ); };
I am using POST since the request is made from JS which knows about the user's environment.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Dancer::send_file only for POST?
by Corion (Patriarch) on Nov 11, 2015 at 14:34 UTC | |
by 1nickt (Canon) on Nov 11, 2015 at 15:02 UTC |