PerlDancer / Dancer

The easiest way to write web applications with Perl (Perl web micro-framework)
http://perldancer.org/
737 stars 209 forks source link

Dancer::Plugin::Ajax affects routes that dont use the `ajax` keyword #879

Open throughnothing opened 11 years ago

throughnothing commented 11 years ago

Because of the before hook it uses, it can alter the content_type response of even normal routes.

I ran across this issue when trying to get the raw html of one of my routes with a jQuery ajax request. The jQuery request was never having its success event fired, because the before hook in the Ajax plugin was detecting it as an ajax request and setting the content-type to text/xml instead of text/html as it should have.

I don't think this plugin should alter routes in this way unless they are routes created using the ajax keyword.

kevzettler commented 11 years ago

+1

sukria commented 11 years ago

Very good point. Could you open a bug against Dancer 2 for this? Thanks!

2013/1/3 Kev Zettler notifications@github.com

+1

— Reply to this email directly or view it on GitHubhttps://github.com/PerlDancer/Dancer/issues/879#issuecomment-11832787.

sukria commented 11 years ago

Oh wait, I got puzzled by the GH email, I'll fork the issue.