Skip to content

DELETE parameters #688

@pawelduszczak

Description

@pawelduszczak

Hi.

I've been testing this library and I have one issue with DELETE.

I'm sending simple request:
DELETE http://site.com/api/user/id/0

I was expecting parameter id to be returned by the method $this->delete('id') and that did not happened. Parameter was instead reachable by $this->get('id').

I did some simple modification to combine _delete_args with URI params:
protected function _parse_delete() { // These should exist if a DELETE request if ($this->input->method() === 'delete') { $this->_delete_args = array_merge($this->input->input_stream(), $this->uri->uri_to_assoc()); } }

But i'm not sure that this solution is proper. Can You tell me what can be the problem i can't get params with $this->delete('param_name')?

Here is also raw request - response data from my tests before modification, where "error" is returned due to lack of "id" in "delete" method:

DELETE http://site.com/api/user/id/0

-- response --
400 Bad Request
Server: nginx/1.6.2
Date: Fri, 12 Aug 2016 07:00:11 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Set-Cookie: csrf_cookie_aw_cms=84a3044ab615870d6f71c13b2bb8a9ab; expires=Fri, 12-Aug-2016 09:00:11 GMT; Max-Age=7200; path=/ cisession=562b51a6ad0f8feef0c2b8a414ce5afa255be2b0; expires=Fri, 12-Aug-2016 09:00:11 GMT; Max-Age=7200; path=/; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Transfer-Encoding: chunked

$this->delete()
array(0) {
}
$this->get()
array(1) {
["id"]=>
string(1) "0"
}
$this->post()
array(0) {
}
$this->put()
array(0) {
}
{"message":"Method delete ERROR","id":0}

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions