post_or_put

in lib/gitlab_api.rb [43:57]


  def post_or_put(path, body:, method:)
    path = "#{ENDPOINT}/#{path}" unless path.start_with?(ENDPOINT)

    options = {
      body: body,
      headers: { 'Private-Token': token }
    }

    HTTParty.send(method, path, options).tap do |response|
      expected_code = method == :post ? 201 : 200

      check_response_code!(method, path, response, expected_code: expected_code)
    end
  end