Log message #4018268

# At Username Text
# Apr 20th 2017, 09:38 Neon1024 That’s micro-optimisation
# Apr 20th 2017, 09:38 Neon1024 Who cares what it checks
# Apr 20th 2017, 09:38 crazycoder so i must do something like if ($this->controller->request->header('Content-type') == 'application/json') { ... }
# Apr 20th 2017, 09:38 crazycoder Neon1024, no no wait..i am saying it checks the extension AND the headers...but in this case we do not need the ext checks
# Apr 20th 2017, 09:37 Neon1024 charolastra: I’d use elements to build the form
# Apr 20th 2017, 09:37 Neon1024 It would be a pretty crappy detector if it just relied on the extension and not the headers!
# Apr 20th 2017, 09:37 charolastra hi, when having a number of views which just differ in the text but are the same otherwise (like a form with different questions), would you make an action for each of them or can i define the template in the single action?
# Apr 20th 2017, 09:37 Neon1024 But you’re setting those headers in your middleware
# Apr 20th 2017, 09:35 crazycoder so we cannot use it
# Apr 20th 2017, 09:35 crazycoder Check to see whether the request >>>> has ‘json’ extension <<<<< and accept ‘application/json’ mimetype. <-------
# Apr 20th 2017, 09:35 crazycoder Neon1024, is('json') is not good in that case
# Apr 20th 2017, 09:26 crazycoder so why forcing it in cake ^?
# Apr 20th 2017, 09:26 crazycoder but when i send the request through postman i already set this header
# Apr 20th 2017, 09:26 crazycoder Neon1024, wait should i write it in request right ?
# Apr 20th 2017, 09:23 crazycoder np
# Apr 20th 2017, 09:23 crazycoder ok
# Apr 20th 2017, 09:23 crazycoder i think it is just setting application/json in content-type header
# Apr 20th 2017, 09:22 Neon1024 I think you’d get more out of it building your own, I know I did
# Apr 20th 2017, 09:20 crazycoder i ma lazy this morning ahah
# Apr 20th 2017, 09:20 crazycoder Neon1024, can you post you middleware that set the header ? :D
# Apr 20th 2017, 09:19 crazycoder ( i am removing the .json extension too )
# Apr 20th 2017, 09:19 crazycoder what a framework! awesome
# Apr 20th 2017, 09:19 crazycoder ok
# Apr 20th 2017, 09:18 Neon1024 If you don’t then you could write your own detector, but I’ve had no issues with is(‘json’) personally
# Apr 20th 2017, 09:17 crazycoder should i check the headers manually?
# Apr 20th 2017, 09:17 crazycoder Neon1024, do you not trust is('json') ? :D
# Apr 20th 2017, 09:17 Neon1024 Seems okay to me, although I’d trust parsing it with PHP more than what I think ;p
# Apr 20th 2017, 09:16 crazycoder ?
# Apr 20th 2017, 09:16 crazycoder Neon1024, looks good to you https://gist.github.com/anonymous/b87f711b96154aed69ad57a3d742393c#file-test-php-L30-L34
# Apr 20th 2017, 09:15 Neon1024 https://book.cakephp.org/3.0/en/controllers/request-response.html#checking-request-conditions
# Apr 20th 2017, 09:15 crazycoder awesome
# Apr 20th 2017, 09:15 Neon1024 $this->request->is(‘json’)
# Apr 20th 2017, 09:15 Neon1024 Yes it does
# Apr 20th 2017, 09:14 Neon1024 Buongiorno!
# Apr 20th 2017, 09:14 crazycoder to avoid setting the type to "html"
# Apr 20th 2017, 09:14 crazycoder i am chaning my custom ExceptionRenderer
# Apr 20th 2017, 09:14 crazycoder is('json') exists?
# Apr 20th 2017, 09:14 crazycoder morning!
# Apr 20th 2017, 09:14 Neon1024 Morning crazycoder
# Apr 20th 2017, 09:13 crazycoder Neon1024, ! :D
# Apr 20th 2017, 09:13 crazycoder hello