diff options
author | dakkar <dakkar@thenautilus.net> | 2017-12-16 20:47:35 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2017-12-16 20:47:35 +0000 |
commit | ab7850cf78f108b868b9030a8e05fcd1ef06fea2 (patch) | |
tree | 079fa8ad6430002f2637486755f0f1e7adcffc35 | |
parent | nicer application / server structure (diff) | |
download | Ultramarine-ab7850cf78f108b868b9030a8e05fcd1ef06fea2.tar.gz Ultramarine-ab7850cf78f108b868b9030a8e05fcd1ef06fea2.tar.bz2 Ultramarine-ab7850cf78f108b868b9030a8e05fcd1ef06fea2.zip |
trace requests&responses
-rw-r--r-- | bin/ultramarine | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/ultramarine b/bin/ultramarine index b01527c..08c11a5 100644 --- a/bin/ultramarine +++ b/bin/ultramarine @@ -32,13 +32,27 @@ my $ultramarine = route { include rest => $ultramarine_rest; } - +my class Trace does Cro::HTTP::Middleware::RequestResponse { + method process-requests(Supply $requests --> Supply) { + supply whenever $requests -> $req { + say $req.Str; + emit $req; + } + } + method process-responses(Supply $responses --> Supply) { + supply whenever $responses -> $res { + say $res.Str; + emit $res; + } + } +} my Cro::Service $um = Cro::HTTP::Server.new( :host<192.168.1.145>, :port<8080>, application => $ultramarine, before => [ + Trace, Ultramarine::Middleware::Authentication.new(:$users), ], add-body-serializers => [ |