Closed ngekoding closed 3 years ago
Hi, I got a problem when trying to post data, the body response incorrect. When I try to use Postman, everything is fine.
Here is my code and the results.
public function adjust_balance($username, $adjustment, $comment = '') { $query_params = ['username' => $username, 'token' => $this->token]; $body = ['adjustment' => $adjustment, 'comment' => $comment]; $url = $this->base_url.'adjust-balance?'.http_build_query($query_params); $response = Request::post($url)->body($body, Mime::FORM)->send(); return $response; }
And here the response with Postman.
Can anyone help?
PHP 5.6 httpful ^0.2.20
Thanks in advance
Manually add ->expectsJson() solving the problem.
->expectsJson()
Hi, I got a problem when trying to post data, the body response incorrect. When I try to use Postman, everything is fine.
Here is my code and the results.
And here the response with Postman.
Can anyone help?
PHP 5.6 httpful ^0.2.20
Thanks in advance