Sending data with Delete request gives : Illegal string offset 'type' #260

Closed
chawdaketan opened this Issue Jan 6, 2017 · 2 comments

Projects

None yet

2 participants

@chawdaketan
chawdaketan commented Jan 6, 2017 edited

I have use-case where I need some additional information before deleting actual entity.
So I need to be able to pass data with DELETE requests

// Execute request
        $response = Requests::delete($url, $this->headers, json_encode($data));

illegal string offset type

Enhancement may be ?
delete - improvements
may be

@rmccue
Owner
rmccue commented Jan 11, 2017

You can directly call Requests::request instead. DELETE has undefined semantics for body data (RFC 7231, §4.3.5), so it's not supported in the short convenience method.

$response = Requests::request( $url, $headers, $data, Requests::DELETE, $options );`
@rmccue rmccue closed this Jan 11, 2017
@chawdaketan
chawdaketan commented Jan 11, 2017 edited

Hi, it don't like json_encode($data), it works with other requests such as PATCH but not with $response = Requests::request($url, $this->headers, json_encode($data), Requests::DELETE);
Error : http_build_query(): Parameter 1 expected to be Array or Object. Incorrect value given

Patch working ex : $response = Requests::patch($url, $this->headers, json_encode($data));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment