---
name: "Plack::App::Proxy::Test"
section: "3pm"
platform: "linux"
package: "libplack-app-proxy-perl"
version: "0.29-1.1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Plack::App::Proxy::Test"
---

# Plack::App::Proxy::Test(3pm)

Is utilities to test Plack::App::Proxy.

## NAME

Plack::App::Proxy::Test - Is utilities to test Plack::App::Proxy.

## SYNOPSIS

```
  test_proxy(
      app   => $backend_app,
      proxy => sub { Plack::App::Proxy->new(remote => "http://$_[0]:$_[1]") },
      client => sub {
          my $cb = shift;
          my $res = $cb->(GET '/');
          ok $res->is_success, "Check the status line.";
      },
  );
```

## DESCRIPTION

Plack::App::Proxy::Test provids test\_proxy function which wraps  test\_psgi of Plack::Test simply.

## FUNCTIONS

- test\_proxy

  ```
    test_proxy app    => $app,
               proxy  => $proxy_cb->($app_host, $app_port),
               client => $client_cb->($cb);
  ```

test\_proxy runs two servers, '`"app"`' as an origin server and the proxy server. In '`"proxy"`' callback, you should create the proxy server instance to send  requests to '`"app"`' server. Then '`"client"`' callback is called to run your  tests. In '`"client"`' callback, all HTTP requests are sent to '`"proxy"`'  server. (And the proxy server will proxy your request to the app server.)

## AUTHOR

Masahiro Honma \<hiratara@cpan.org\>

## SEE ALSO

Plack::App::Proxy Plack::Test
