httpful icon indicating copy to clipboard operation
httpful copied to clipboard

Verify if is a string httpful/src/Httpful/Request.php on line 953

Open ghost opened this issue 9 years ago • 2 comments

Resolves the warning:

PHP Warning: mb_strlen() expects parameter 1 to be string, array given in httpful/src/Httpful/Request.php on line 953

ghost avatar Mar 06 '15 15:03 ghost

The serialized payload that we pass to this method should always be a string. What case were you running into where this wasn't the case? @michelwilhelm

nategood avatar Mar 08 '15 15:03 nategood

This is a snippet:

$animal = [
  'var' => 'foo'
];

$response = \Httpful\Request::post($request)->
        sendsJson()->
        body($animal)->
        addHeader('Authorization', 'Token  '.$user['token'])->
        addHeader('Content-Type', 'application/json')->
        addHeader('Accept', 'application/json')->
        send();

ghost avatar Mar 08 '15 15:03 ghost