NAME

Weather::NHC::TropicalCyclone::HTTP - small, injectable HTTP boundary for Weather::NHC::TropicalCyclone

DESCRIPTION

This internal class centralizes HTTP::Tiny access so the public NHC client and storm objects do not create HTTP clients throughout the code. Supplying a mock client to "new" in Weather::NHC::TropicalCyclone therefore makes network behavior fully deterministic in tests.

METHODS

new

my $http = Weather::NHC::TropicalCyclone::HTTP->new(
    client => $http_tiny_compatible_object,
);

The client must provide get and mirror methods with HTTP::Tiny-compatible response hashes.

get

Performs an HTTP GET and returns the successful HTTP::Tiny-style response hash.

mirror

Downloads a URL to a local file and returns the successful response hash.

Both methods perform a request and throw an exception for unsuccessful responses.