Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check if source-url is accessible #18

Open
gfldex opened this issue Mar 24, 2017 · 0 comments
Open

check if source-url is accessible #18

gfldex opened this issue Mar 24, 2017 · 0 comments

Comments

@gfldex
Copy link
Contributor

gfldex commented Mar 24, 2017

This one just bit me.

The following code requires HEAD of HTTP::Client, which zef does not see yet, PR for that is pending.

use v6;
use HTTP::Client;

sub try-to-fetch-url($_) {
    my $response = HTTP::Client.new.head(.Str, :follow);
    CATCH { default { $response = Nil } }
    200 <= $response.?status < 400
}

say so try-to-fetch-url('https://github.com/gfldex/');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant