-
Notifications
You must be signed in to change notification settings - Fork 25
Ajax component can't handle responses bigger than 4096 #33
Comments
I doubt this is anything that I am doing, the component is pretty straight forward. I'll look into it. |
found anything interesting? :) |
Nope. There's nothing in my code that would cause this. Looked into Cake's RequestHandler and didn't find anything there either. Perhaps it's a server configuration? |
If I put a header content type application json right in your case json on the last function then it works, but I don't wana do that, did you try it on your server and you could do more than 4096? |
I have not as I don't use CakePHP anymore and have no applications running it. The RequestHandler sets the content type, not my component. https://github.com/milesj/utility/blob/master/Controller/Component/AjaxHandlerComponent.php#L147 You're passing JSON to I also wonder if it's failing somewhere else in Cake, like the Response class. https://github.com/cakephp/cakephp/blob/master/lib/Cake/Network/CakeResponse.php#L709 |
I left your line 147 as it is, and im doing Would you be willing to setup a simple cake project and try it out? |
When I have time (which won't be anytime soon). I'd try debugging why RequestHandler/Response isn't setting the content type. Forcing the type through headers is the wrong approach. |
I know it's the wrong approach but it works. I've tried debugging the request handler / response but got nowhere, at the end $ctype was application/json and $type was json. Even after all that the header content type in the browser was showing up as text/html... so can't really think of anything else =/ |
I wonder if it's happening further down the chain. What about setting the content type manually from your action? Instead of the component? |
haven't tried from controller / action yet... will do when i get to work tomorrow. |
Haven't had a chance to try it out yet, deadlines at work, last 2 days before holidays, couldn't even touch that specific cake project... |
Same. I probably won't be able to look at this until after the holidays. |
If you have a response bigger than 4096 then the request type will be text/html instead of application/json
Tested on CakePHP 2.5.7
The text was updated successfully, but these errors were encountered: