-
Notifications
You must be signed in to change notification settings - Fork 19
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
[Lib/InnerBrowser] Send raw content in post body #61
Comments
REST methods are more flexible in that regard, they send |
Thanks @Naktibalda, does this mean there are no plans for adding this feature in the InnerBrowser module? I could help out with writing a PR if you could just push me in the right direction. Would it be acceptable to refactor the inner browser method to behave exactly like in the REST module (send as-if if isn't array and keep current behaviour if param is array) |
You are welcome to make a pull request, though now isn't the best time for it. |
I was just about to file a new issue "Support sendPOST with raw body content AND query parameters [REST module]", but am hesitating now... Cf. comment by @davidjeddy in Codeception/Codeception#375 (comment)
@krukru Therefore I think "refactor the inner browser method to behave exactly like in the REST module (send as-if if isn't array and keep current behaviour if param is array)" is not a good idea -- unless I misunderstand you and your goal is support for sending requests with raw body content AND query parameters at the same time... Related issues:
@Naktibalda (Unrelated to this issue, but...) Because you just mentioned Codeception 4 to be released soon: Would it please be possible to merge my recent little PRs (Codeception/phpunit-wrapper#62 + Codeception/Codeception#5690; Codeception/Codeception#5688) for 2 IMHO rather bad Codeception bugs before and soon release them in a (last?) 3.1.x version; and of course also merge them into new Codeception 4 codebase? (This would be very motivating and also promising with respect to the future usage of Codeception...) Thanks! |
What are you trying to achieve?
I am trying to call
sendAjaxPostRequest
and I would like to pass raw, unformatted parameters to the server.For example
What do you get instead?
I get an error saying that the second parameter of sendAjaxPostRequest must be of type array. This array then gets converted using http_build_query and there is no way to pass raw data. See https://github.com/Codeception/Codeception/blob/3.1/src/Codeception/Lib/InnerBrowser.php#L189
When passing an array, the array always gets converted to http query params format of
foo=bar&example=codeception
I think an alternative approach could be to use REST Module, which I think can accept raw content (or at least properly json_encode body).
Is there something I am missing? How would you suggest to test this endpoint?
The text was updated successfully, but these errors were encountered: