App-GitHubPullRequest

 view release on metacpan or  search on metacpan

lib/App/GitHubPullRequest.pm  view on Meta::CPAN

            encode_json($data),
        )
    );
}

# Perform HTTP GET
sub _get_url {
    my ($url, $return_on_error) = @_;
    croak("Please specify a URL") unless $url;

    # See if we should use credentials
    my @credentials;
    if ( _is_api_url($url) ) {
        my $token = _qx('git', 'config github.pr-token');
        @credentials = ( '-H', "Authorization: token $token" ) if $token;
    }

    # Send request
    my ($content, $rc) = _run_ext(
        'curl',
        '-L',                            # follow redirects
        '-s',                            # be silent
        '-w', '%{http_code}',            # include HTTP status code at end of stdout
        @credentials,                    # Logon credentials, if any
        $url,                            # The URL we're GETing
    );
    die("curl failed to fetch $url with code $rc.\n") if $rc != 0;

    my $code = substr($content, -3, 3, '');

    return $content, $code if $return_on_error;

    if ( $code >= 400 ) {
        die("Fetching URL $url failed with code $code:\n$content");

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.427 second using v1.00-cache-2.02-grep-82fe00e-cpan-f73e49a70403 )