3
最近我升級我的休息服務器ZF2 Apigility,其內容協商設置如下,如何使ZF2 Apigilty接受客戶端的請求沒有在頭Accept,接受設置
'zf-content-negotiation' => array(
'controllers' => array(
'CloudSchoolBusFileApi\\V1\\Rest\\FileReceiver\\Controller' => 'Json',
),
'accept_whitelist' => array(
'CloudSchoolBusFileApi\\V1\\Rest\\FileReceiver\\Controller' => array(
0 => 'application/vnd.cloud-school-bus-file-api.v1+json',
1 => 'application/json',
),
),
'content_type_whitelist' => array(
'CloudSchoolBusFileApi\\V1\\Rest\\FileReceiver\\Controller' => array(
0 => 'application/vnd.cloud-school-bus-file-api.v1+json',
1 => 'application/json',
2 => 'multipart/form-data',
),
),
的問題是,我的客戶(mobie應用程序)已經部署,並且它們在http標題中發送沒有接受字段設置的發佈請求。所以我總是得到以下來自服務器的406錯誤,
[Response] => Array
(
[statusCode] => 406
[content] => {"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Not Acceptable","status":406,"detail":"Cannot honor Accept type specified"}
)
因此,任何人對如何讓服務器接受來自客戶端的報頭沒有受理該申請的想法?
謝謝!我最終攻擊了zf-content-negotiation模塊,AcceptFilterListener.php,添加了上面的代碼,它工作正常! –
有同樣的問題,但與soapui:我添加了標題,它的工作 – cwhisperer