As stated in the documentation on:
https://gerrit-review.googlesource.com/Documentation/rest-api.html
"To prevent against Cross Site Script Inclusion (XSSI) attacks, the JSON response body starts with a magic prefix line that must be stripped before feeding the rest of the response body to a JSON parser:"
It would be nice to have some sort of "skip n-chars" from body in order to have a correct JSON.
I fixed it by just adding a patch in stripBom function in MimeHandlerAdapter.php :
$body = substr($body,4); // cut )]}'
and building it to .phar which I use.
However, I am no php developer, so I feel there should be a cleaner way, and cover wider-case
scenarios.
As stated in the documentation on: https://gerrit-review.googlesource.com/Documentation/rest-api.html "To prevent against Cross Site Script Inclusion (XSSI) attacks, the JSON response body starts with a magic prefix line that must be stripped before feeding the rest of the response body to a JSON parser:"
So, getting content from: https://android-review.googlesource.com/changes/?q=limit:2+q=status:merged&o=CURRENT_REVISION
presents an error.
It would be nice to have some sort of "skip n-chars" from body in order to have a correct JSON. I fixed it by just adding a patch in stripBom function in MimeHandlerAdapter.php : $body = substr($body,4); // cut )]}' and building it to .phar which I use.
However, I am no php developer, so I feel there should be a cleaner way, and cover wider-case scenarios.