Skip Menu |

This queue is for tickets about the jQuery-File-Upload CPAN distribution.

Report information
The Basics
Id: 84300
Status: resolved
Priority: 0/
Queue: jQuery-File-Upload

People
Owner: violapiratejunky [...] gmail.com
Requestors: lukas.rampa [...] centrum.cz
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.12
Fixed in: (no value)



Subject: Use text/plain in response when client does not accept application/json
Hi, Thanks for the module, it came just in time for me :-) I have a feature request: For jQuery-File-Upload to work with IE, server must send JSON response with text/plain content type instead of default application/json. Something like (especially for Catalyst): my $content_type = 'text/plain'; if ($c->req->headers->header('Accept') =~ qr(application/json) ) { $content_type = 'application/json'; } I created my own verision of print_response method with above functionality, but I guess everyone needs that sooner or later. Regards, Lukas Rampa
Hi Lukas, That's a good suggestion. A good workaround for right now could be calling the output method after you call handle response: https://metacpan.org/module/jQuery::File::Upload#output This returns the JSON that print_response prints out to the browser. This way you can take care of printing your own content-type followed by the JSON. Cheers, Adam On Fri Mar 29 22:38:14 2013, rampa wrote: Show quoted text
> Hi, > Thanks for the module, it came just in time for me :-) > > I have a feature request: > For jQuery-File-Upload to work with IE, server must send JSON response > with text/plain content type instead of default application/json. > > Something like (especially for Catalyst): > my $content_type = 'text/plain'; > if ($c->req->headers->header('Accept') =~ qr(application/json) ) { > $content_type = 'application/json'; > } > > I created my own verision of print_response method with above > functionality, but I guess everyone needs that sooner or later. > > Regards, > Lukas Rampa
Lukas, I've added the patch you suggested and it should be working now. Unfortunately, I do not have access to IE right now. If you get a chance to try it out, would you let me know if it works? That way I can close the issue :) Thanks! Adam On Fri Mar 29 22:38:14 2013, rampa wrote: Show quoted text
> Hi, > Thanks for the module, it came just in time for me :-) > > I have a feature request: > For jQuery-File-Upload to work with IE, server must send JSON response > with text/plain content type instead of default application/json. > > Something like (especially for Catalyst): > my $content_type = 'text/plain'; > if ($c->req->headers->header('Accept') =~ qr(application/json) ) { > $content_type = 'application/json'; > } > > I created my own verision of print_response method with above > functionality, but I guess everyone needs that sooner or later. > > Regards, > Lukas Rampa