Switch post-receive API calls to JSON for Mercurial projects
Because GitLab's internal API relies on request parsing provided by Grape and/or Rack, the post_receive
internal API endpoint accepts both multipart/form-data
and application/json
. For Mercurial repositories, we've always used the former, but GitLab components that send post-receives actually use the latter.
This is problematic for nested structures, such as lists (e.g. push_options
) where only the last element is actually visible after parsing. In the case of hg_prunes
, we've settled for JSON serialization of the value from the onset, which didn't create more divergence with upstream, since it's specific.
It would be much better to switch to JSON for the whole payload. This requires careful treatment of the bytes
vs str
pain on the Python side.