fusionauth-php-client icon indicating copy to clipboard operation
fusionauth-php-client copied to clipboard

Cut 'empty' params in request (JSONBody)

Open aburnet opened this issue 4 years ago • 2 comments

I'm trying to do something like this: $request = [ 'loginId' => $hostData->getUser()->getUsername(), 'sendForgotPasswordEmail' => false ]; $response = $this->client->forgotPassword($request); but library remove params sendForgotPasswordEmail. I found something like this in code (JSONBodyHandler:427) $this->body = json_encode(array_filter($bodyObject)); function array_filter without callback remove all empty records from array. In my case remove sendForgotPasswordEmail but it is general problem with this function. It remove values with false and 0.

aburnet avatar Mar 22 '21 15:03 aburnet

Ah, that is an issue. Can you please try

$request = [ 'loginId' => $hostData->getUser()->getUsername(), 'sendForgotPasswordEmail' => "false" ];

and see if that gets you what you want?

mooreds avatar Mar 22 '21 23:03 mooreds

yes, it is working, but not looks good. But solves problem, thanks.

aburnet avatar Mar 23 '21 09:03 aburnet