I am attempting to post login credentials to an apigility login API:
$response = ClientStatic::post(
'http://www.example.com/api/login',
array('email' => 'test@eample.com','password' => 'test'),
array('Accept' => 'application/json')
);
This returns the error:
Cannot honor Accept type specified
As far as I can tell, application/json
has been whitelisted in the configs:
Any ideas?
My Apigility config:
<?php
return array(
'controllers' => array(
'factories' => array(
'Api\\V1\\Rpc\\Login\\Controller' => 'Api\\V1\\Rpc\\Login\\LoginControllerFactory',
),
),
'router' => array(
'routes' => array(
'api.rpc.login' => array(
'type' => 'Segment',
'options' => array(
'route' => '/api/login',
'defaults' => array(
'controller' => 'Api\\V1\\Rpc\\Login\\Controller',
'action' => 'login',
),
),
),
),
),
'zf-versioning' => array(
'uri' => array(
0 => 'api.rpc.login',
),
),
'zf-rpc' => array(
'Api\\V1\\Rpc\\Login\\Controller' => array(
'service_name' => 'Login',
'http_methods' => array(
0 => 'POST',
1 => 'GET',
),
'route_name' => 'api.rpc.login',
),
),
'zf-content-negotiation' => array(
'controllers' => array(
'Api\\V1\\Rpc\\Login\\Controller' => 'Json',
),
'accept_whitelist' => array(
'Api\\V1\\Rpc\\Login\\Controller' => array(
0 => 'application/vnd.api.v1+json',
1 => 'application/json',
2 => 'application/*+json',
),
),
'content_type_whitelist' => array(
'Api\\V1\\Rpc\\Login\\Controller' => array(
0 => 'application/vnd.api.v1+json',
1 => 'application/json',
),
),
),
'zf-content-validation' => array(
'Api\\V1\\Rpc\\Login\\Controller' => array(
'input_filter' => 'Api\\V1\\Rpc\\Login\\Validator',
),
),
'input_filter_specs' => array(
'Api\\V1\\Rpc\\Login\\Validator' => array(
0 => array(
'required' => true,
'validators' => array(
0 => array(
'name' => 'Zend\\Validator\\EmailAddress',
'options' => array(
'useDomainCheck' => true,
),
),
),
'filters' => array(),
'name' => 'email',
'description' => 'Email address',
'error_message' => 'Email address error',
),
1 => array(
'required' => true,
'validators' => array(),
'filters' => array(),
'name' => 'password',
'description' => 'Password required',
'error_message' => 'Password error',
),
),
),
'zf-mvc-auth' => array(
'authorization' => array(
'Api\\V1\\Rpc\\Login\\Controller' => array(
'actions' => array(
'Login' => array(
'GET' => false,
'POST' => false,
'PUT' => false,
'PATCH' => false,
'DELETE' => false,
),
),
),
),
),
);