0

as stated here

for public repository - https://bitbucket.org/kirchbergerknorr/test i setted up hook for Pull Request POST: hook settings

then i created pull request and here is dump for GET and POST vars:

GET: Array
(
    [type] => pullrequest
    [project] => test
)

POST: Array
(
)

i expect that it should work the same as POST hook works:

POST: Array
(
    [payload] => {"repository": {"website": "", ...

but POST var is totally empty

Aleksey Razbakov
  • 624
  • 8
  • 29

1 Answers1

1

Kaleb Elwert post an answer in bugtracker:

For now, I'm going to leave this as-is. However, this is not a bug. The original POST hook provided the JSON data in a "payload" POST variable, however this is an older method of doing things. In the newer Pull Request POST hook, we simply provide a Content-Type of application/json and include the data as the raw POST data. We have no intention of making any backwards incompatible changes with either of these hooks, so your best bet is to have a separate endpoint which manages pull request hooks. This is a modified version of your sample code which will pull the json into the $data variable.

https://confluence.atlassian.com/display/BITBUCKET/Pull+Request+POST+hook+management

<?php

$json = file_get_contents('php://input');
if (!$json) {
    return false;
}

$data = json_decode($json);
Aleksey Razbakov
  • 624
  • 8
  • 29