We don't bite newbies here... much | |
PerlMonks |
Dancer bugs? send_file(), content type, and response_content_is()by hardburn (Abbot) |
on Mar 01, 2013 at 16:25 UTC ( [id://1021293]=perlquestion: print w/replies, xml ) | Need Help?? |
hardburn has asked for the wisdom of the Perl Monks concerning the following question: I've been playing with Dancer for the first time, and I think I found some bugs. I'm posting here to see if this is a ligit bug or if I'm doing something wrong. I added a file under the public dir of /javascripts/test.js with the text var test = 1;. The Dancer route looks like this:
(There may be better ways to do this, but I'm doing it this way for learning purposes.) I also wrote tests to handle that:
Those fail with:
In the debugger, I stepped into reponse_headers_include() and found the response looks like this:
Notice above that the MIME type override (content_type => 'text/javascript') was not respected as documented in Dancer::send_file(). Also, the response_content_is() is failing because send_file() is returning a filehandle, which I feel should have been automatically expanded rather than failing this way. Removing streaming => 1 does not fix the test. It does return the right data when I check it in a browser. Also, I originally had a response_exists() test, but the test failed with a deprecation warning. There's no mention of the deprecation in the Dancer::Test docs. If these are indeed a ligit bug, I already see how to fix the response_content_is problem and can probably figure out the content type override. However, I've been giving Dancer a try for an hour and I'm already running into bugs and documentation errors. Frankly, that's not a good sign of a mature framework. "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.
Back to
Seekers of Perl Wisdom
|
|