Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too few arguments to function #29

Open
rusdyahmad opened this issue Jan 22, 2023 · 1 comment
Open

Too few arguments to function #29

rusdyahmad opened this issue Jan 22, 2023 · 1 comment

Comments

@rusdyahmad
Copy link

Curl

curl --location --request POST 'http://localhost:3000/id/messages/send' \
--data-raw '{
    "jid": "01234567890",
    "type": "group",
    "message": {
        "text": "Hello"
    }
}'

Convert

Http::withBody('{
    "jid": "01234567890",
    "type": "group",
    "message": {
        "text": "Hello"
    }
}')
    ->post('http://localhost:3000/id/messages/send');

ArgumentCountError

Too few arguments to function Illuminate\Http\Client\PendingRequest::withBody(), 1 passed in /vendor/laravel/framework/src/Illuminate/Http/Client/Factory.php on line 427 and exactly 2 expected

Laravel Framework 9.43.0

@jasonmccreary
Copy link
Collaborator

Yeah, this is a tough one. A lot of people use data-raw when really they are just posting data. If you really want to send the JSON in the body, then add application/json as the second parameter.

I'm hoping to make this the default in Laravel 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants