Skip to content

Instantly share code, notes, and snippets.

@leedo
Created February 29, 2012 02:18
Show Gist options
  • Save leedo/1937034 to your computer and use it in GitHub Desktop.
Save leedo/1937034 to your computer and use it in GitHub Desktop.
my $orig = \&Noembed::Util::http_get;
local *Noembed::Util::http_get = sub {
my $cb = pop;
my $url = shift;
my $hash = sha1_hex $url;
$orig->($url, @_, sub {
my ($body, $headers) = @_;
open my $fh, ">", "t/data/requests/$hash";
print $fh encode_json [ $body, $headers ];
$cb->($body, $headers)
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment