2 # ABSTRACT: A backend for testing HTTP::AnyUA
7 use Scalar
::Util
qw(blessed);
10 use parent
'HTTP::AnyUA::Backend';
15 $response = $backend->response;
16 $response = $backend->response($response);
18 Get
and set the response hashref
or L
<Future
> that this backend will always respond with
.
22 sub response
{ @_ == 2 ? $_[0]->{response
} = pop : $_[0]->{response
} }
26 @requests = $backend->requests;
28 Get the requests the backend
has handled so far
.
32 sub requests
{ @{$_[0]->{requests
} || []} }
34 sub response_is_future
{ blessed
($_[0]->{response
}) && $_[0]->{response
}->isa('Future') }
39 push @{$self->{requests
} ||= []}, [@_];
41 return $self->response || {
44 reason
=> 'Internal Exception',
45 content
=> "No response mocked.\n",