# |
Apr 19th 2017, 15:47 |
crazycoder |
ok so you are using a custom iddleware to set application/json and the $this->loadComponent('RequestHandler'); |
# |
Apr 19th 2017, 15:45 |
crazycoder |
ok so i must change the renderer too |
# |
Apr 19th 2017, 15:45 |
Neon1024 |
The middleware modifies, or can modify both incoming requests and outgoing responses |
# |
Apr 19th 2017, 15:45 |
crazycoder |
Neon1024, oh ok so the renderer will override it |
# |
Apr 19th 2017, 15:45 |
Neon1024 |
The middleware would set the header on the incoming request, so by the time it reached the renderer it would have the header already |
# |
Apr 19th 2017, 15:44 |
crazycoder |
if i do not touch https://gist.github.com/anonymous/f23de065af63b1388b64bd8332bdf031#file-gistfile1-txt-L29 |
# |
Apr 19th 2017, 15:44 |
crazycoder |
Neon1024, i mean the middleware set it AFTER the error renderer no? |
# |
Apr 19th 2017, 15:44 |
Neon1024 |
Sorry, I’m not sure what you mean |
# |
Apr 19th 2017, 15:43 |
crazycoder |
Neon1024, sure |
# |
Apr 19th 2017, 15:43 |
Neon1024 |
crazycoder: Be sure to contribute back any thoughts to the repo :) |
# |
Apr 19th 2017, 15:43 |
crazycoder |
Neon1024, If i do not touch the error renderer...can i only add the middleware that set application/json ? |
# |
Apr 19th 2017, 15:43 |
Neon1024 |
crazycoder: Awesome! :) |
# |
Apr 19th 2017, 15:43 |
highac3s |
hello |
# |
Apr 19th 2017, 15:42 |
crazycoder |
with cakephp/authentication middleware |
# |
Apr 19th 2017, 15:42 |
crazycoder |
Neon1024, yes i am using tokenauth |
# |
Apr 19th 2017, 15:42 |
Neon1024 |
Same for auth really, that should be a header |
# |
Apr 19th 2017, 15:42 |
crazycoder |
if the URI starts with /api |
# |
Apr 19th 2017, 15:42 |
Neon1024 |
Sending the right Content-Type and Accepts headers are the way to go |
# |
Apr 19th 2017, 15:42 |
crazycoder |
ok i will remove it too |
# |
Apr 19th 2017, 15:41 |
Neon1024 |
It exists in the CakePHP core as a kind debugging thing |
# |
Apr 19th 2017, 15:41 |
Neon1024 |
..and because jsonapi.org says not to |
# |
Apr 19th 2017, 15:41 |
crazycoder |
ok |
# |
Apr 19th 2017, 15:41 |
crazycoder |
oh right..pardon |
# |
Apr 19th 2017, 15:41 |
Neon1024 |
Because I was told not to use the .json extension |
# |
Apr 19th 2017, 15:41 |
crazycoder |
so i can set it on the renderer in that case (for errors) |
# |
Apr 19th 2017, 15:41 |
crazycoder |
Neon1024, but i do not get one point...why did you add a middleware to set the application/json... imean... if the extension is json it is obviosuly json no? (globally i mean) |
# |
Apr 19th 2017, 15:40 |
crazycoder |
:D |
# |
Apr 19th 2017, 15:40 |
crazycoder |
Neon1024, i am using it too |
# |
Apr 19th 2017, 15:39 |
admad |
They are a bunch of slackers |
# |
Apr 19th 2017, 15:39 |
Neon1024 |
I say ‘we’ I mean the team building it :p |
# |
Apr 19th 2017, 15:38 |
Neon1024 |
Hopefully some more people can try it too and we can get it to a 1.0 release |
# |
Apr 19th 2017, 15:38 |
Neon1024 |
So I can bin requests to my api if they don’t authenticate, without even leaving the middleware stack! :D |
# |
Apr 19th 2017, 15:38 |
Neon1024 |
I’ve also implemented the cakephp/authentication middleware in a branch |
# |
Apr 19th 2017, 15:37 |
Neon1024 |
Everything. You don’t get a choice:p |
# |
Apr 19th 2017, 15:37 |
Neon1024 |
As everything on my /api prefix will be json |
# |
Apr 19th 2017, 15:37 |
Neon1024 |
Well I do that in my middleware |
# |
Apr 19th 2017, 15:35 |
crazycoder |
oh better i set application/json |
# |
Apr 19th 2017, 15:35 |
crazycoder |
right ? |
# |
Apr 19th 2017, 15:35 |
crazycoder |
Neon1024, yes i should check if json...if yes i will skip that line |
# |
Apr 19th 2017, 15:35 |
Neon1024 |
Well there you are! |
# |
Apr 19th 2017, 15:34 |
Neon1024 |
https://gist.github.com/anonymous/f23de065af63b1388b64bd8332bdf031#file-gistfile1-txt-L29 |