我试图通过fetch从Web服务中删除和删除数据,但是我收到以下错误
净:: ERR_SPDY_PROTOCOL_ERROR
const Headers = { 'Content-Type': 'application/json', 'Access-Control-Request-Method': '*'};
const url =' https://tesisweb.000webhostapp.com/genTesis/api/public/coo/1';
const req = new Request(serverUrl + url, {method: 'PUT', headers: Headers, body: obj});
return fetch(req)
.then(status)
.then((response) => {
return response.json();
});
在BackEnd我使用php slim和eloquent
Middelware
$corsOptions = array(
"origin" => "*",
"exposeHeaders" => array("Content-Type", "X-Requested-With", "X-authentication", "X-client"),
"allowMethods" => array('GET', 'POST', 'PUT', 'DELETE', 'OPTIONS')
); $ cors = new \ CorsSlim \ CorsSlim($ corsOptions);
$ APP->添加($ CORS);