package webhooks

import (
	"io"
	"net/http"
)

const pullRequestLookupDrainLimit = 4 << 10

// PerformPullRequestResourceLookup executes one prepared pull-request lookup
// and owns the response lifecycle. The caller owns request construction and
// provider-specific transport/status classification.
func PerformPullRequestResourceLookup(client *http.Client, request *http.Request) (int, error) {
	response, err := client.Do(request)
	if err != nil {
		return 0, err
	}
	defer response.Body.Close()
	_, _ = io.Copy(io.Discard, io.LimitReader(response.Body, pullRequestLookupDrainLimit))
	return response.StatusCode, nil
}
