-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fix batch publish #198
Fix batch publish #198
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this PR also need to consider a fix for the Http::request
method so that the situation described in #197 cannot happen by design?
At the moment if I were to do something like this, it would still cause the server-side encoding errors:
$payload = array(
"channels" => ["channel1", "channel2", "channel3", "channel4"],
"messages" => array(
"id" => "1",
"data" => "foo"
)
);
$batchPublishPaginatedResult = $ablyrest->request("POST", "/messages", [], json_encode($payload));
This is because passing a string to AblyRest
will cause it not to be encoded any further (we check for !is_string
before applying JSON/msgpack), but Http::request
will still add the Content-Type header (incorrectly) all the same.
2c1b168
to
641c808
Compare
@AndyTWF I agree with your point. |
I feel use of type |
In other SDKs (e.g. Java) we avoid the issue because the Next time there's a breaking version of this SDK, we should consider enforcing parameters types on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend we keep #197 open as this PR doesn't by design prevent the problem from happening :)
Related to #197