Skip to content

calling expectsJson() before body() of a post request breaks response parsing #299

@lukemim

Description

@lukemim
$response = \Httpful\Request::post($url)
->expectsJson()
->body(['abc'=>123], \Httpful\Mime::FORM)
->send();

results in incorrect response body parsing, for example:
Array (size=1) '{"exampleResponseFromServer":"data processed successfully"}' => string '' (length=0)
(the entire raw response body is put in an array key and the array value is empty string)

When ->expectsJson() is called after ->body() the response JSON is parsed correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions