# |
Dec 27th 2019, 02:38 |
latenal |
Hey guys, how do you set a `Content-Type` in `Cake\Http\Client` post-request? I tried ```$response = $this->httpClient->post( $url, ['appId' => $appId, 'secret' => $secret], [ 'headers' => ['content-type' => 'application/json']] );``` This is what it makes: ```POST /login HTTP/1.1 accept: */* Connection: close Content-Length: 34 content-type: application/json content-type: application/x-www-form-urlencoded``` |
# |
Dec 27th 2019, 01:22 |
neothermic |
WRT the modem discussion, speed of your first modem might also be an indicator of when you first got internet... mine was like 300 baud, but we had internet in 94... :P |
# |
Dec 27th 2019, 00:22 |
challgren |
Are you sshing into the remote server? |
# |
Dec 26th 2019, 23:09 |
peppejaripappalardo |
Hello guys, with cakephp 4 i get an error for databaseconnection. ```CakePHP is NOT able to connect to the database. Connection to database could not be established: SQLSTATE[HY000] [2002] No such file or directory``` |
# |
Dec 26th 2019, 19:08 |
AlexMax |
`/join #freenode_#cakephp:matrix.org` from a Matrix client such as Riot. |
# |
Dec 26th 2019, 19:07 |
AlexMax |
So I just found out that you can join the CakePHP IRC channel using the Matrix protocol. |
# |
Dec 26th 2019, 17:33 |
ron.rattie |
My first modem was 2400 baud, I incurred many big long distances phone bills connecting to "local" BBS in Virginia when I was living in Maryland (46 yrs old now) |
# |
Dec 26th 2019, 13:20 |
ndm |
:thinking_face: |
# |
Dec 26th 2019, 13:20 |
slackebot |
<ndm> |
# |
Dec 26th 2019, 13:09 |
dsar |
I really enjoyed that era of internet |
# |
Dec 26th 2019, 13:08 |
dsar |
When I got my first 56k I was so excited to see how MOTDs of various servers were so fast to show up |
# |
Dec 26th 2019, 13:07 |
dsar |
I'm 35 years old and my first modem was a 14.4k |
# |
Dec 26th 2019, 12:47 |
challgren |
Hey I remember when you had to put the headset on the modem! |
# |
Dec 26th 2019, 12:36 |
ndm |
28k was more than enough to download sexy bill gates pictures... |
# |
Dec 26th 2019, 12:19 |
admad |
not 56k? you are old :P |
# |
Dec 26th 2019, 12:06 |
ndm |
@kailas Look, I'm not _that_ old yet, when I was in what you'd call "high school", we already had 28k super high speed modems :) |
# |
Dec 26th 2019, 03:25 |
challgren |
@ndm you are the man! ->onlyMethods() works |
# |
Dec 26th 2019, 01:53 |
ashesh.social |
is there is any possibility to add Log in middleware files ? |
# |
Dec 26th 2019, 01:06 |
challgren |
I'll have to try that, ah no worries man, I hear you man I hear yah |
# |
Dec 26th 2019, 01:04 |
ndm |
Also I'm a little drunk over here, it was a rough day, Christmas is really stressful when you're old :grimacing: |
# |
Dec 26th 2019, 01:02 |
ndm |
If a mocked mailer would normally work, then try the `onlyMethods()` option, that should be fine... I wasn't really getting the full picture initially, hence I recommended the transport |
# |
Dec 26th 2019, 01:01 |
challgren |
Hmmm ok yeah I'm going to need to do more research. |
# |
Dec 26th 2019, 00:59 |
ndm |
If that's in your `aboutUs()` method, then certainly that's the problem, pretty sure that will override the mock transport |
# |
Dec 26th 2019, 00:58 |
challgren |
@ndm I wonder if because I'm calling setProfile([transport => mailgun]) in the mailer function |
# |
Dec 26th 2019, 00:54 |
ashesh.social |
Thanks for the support @ndm @challgren Will check it :+1::skin-tone-3: |
# |
Dec 26th 2019, 00:53 |
ndm |
or maybe a little cleaner like ```$check = [ 'plugin' => 'MyPlugin', 'prefix' => 'Api', 'controller' => 'TeamsController', 'action' => 'payment_status', // ... ]; if (array_intersect_assoc($check, $request->getParams()) === $check) { // ... }``` |
# |
Dec 26th 2019, 00:53 |
challgren |
$this->request->getParam('controller') |
# |
Dec 26th 2019, 00:53 |
ndm |
like `andand $request->getParam('controller') === 'TeamsController' andand $request->getParam('action') === 'payment_status' andand ...` |
# |
Dec 26th 2019, 00:51 |
ashesh.social |
How can I whitelist that method |
# |
Dec 26th 2019, 00:51 |
ashesh.social |
Say I’m having a controller called “TeamsController” and “payment_status” is a method inside that controller |
# |
Dec 26th 2019, 00:50 |
ashesh.social |
Sorry couldn’t get it |
# |
Dec 26th 2019, 00:47 |
ndm |
Compare the `controller` and `action` params too, also `plugin` if you need to |
# |
Dec 26th 2019, 00:45 |
ashesh.social |
How to add particular function in a controller to the above code @challgren @ndm |
# |
Dec 26th 2019, 00:45 |
ashesh.social |
$csrf->whitelistCallback(function ($request) { // Skip token check for API URLs. if ($request->getParam('prefix') === 'Api') { return true; } |
# |
Dec 26th 2019, 00:37 |
ndm |
but still, a mock transport should work... somehow |
# |
Dec 26th 2019, 00:37 |
ndm |
@challgren The initial error surely is because of the static config trait... but if you don't need all that methods mocked, you could just specify the ones you need, like `->onlyMethods(['send'])` |
# |
Dec 26th 2019, 00:36 |
slackebot |
<challgren> |
# |
Dec 26th 2019, 00:36 |
challgren |
https://book.cakephp.org/4/en/controllers/middleware.html#cross-site-request-forgery-csrf-middleware |
# |
Dec 26th 2019, 00:35 |
ashesh.social |
@challgren 4 |
# |
Dec 26th 2019, 00:35 |
challgren |
@ashesh.social 4 or 3? |
# |
Dec 26th 2019, 00:34 |
ashesh.social |
@challgren tried whitelisting with many resources from google. Not working out. |