Using the codeIgniter 3.1.7 + codeigniter-restserver-master using the PUT and DELETE statements returns 401 Unauthorized
config / routs.php file
defined('BASEPATH') OR exit('No direct script access allowed');
$route['default_controller'] = 'home_c';
$route['404_override'] = '';
$route['translate_uri_dashes'] = TRUE;
$route["api/usuario/"]["get"] = "api/usuario";
$route["api/usuario/(:num)"]["get"] = "api/usuario/id/$1";
$route["api/usuario"]["post"] = "api/usuario";
$route["api/usuario/(:num)"]["put"] = "api/usuario/id/$1";
$route["api/usuario/(:num)"]["delete"] = "api/usuario/id/$1";
file controllers / User.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require APPPATH . '/libraries/REST_Controller.php';
class Usuario extends REST_Controller {
function index_put($id) {
$this->response(array("ok" => $this->post), REST_Controller::HTTP_OK);
}
}
When I use postman with the verb PUT Using: headers
key= Content-Type
value=application/javascript
ou
key= Content-Type
value=application/x-www-form-urlencoded
com a URL
returns - > 401 Unauthorized