Skip to content

Commit

Permalink
#22 header with usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Yegor Bugayenko committed Nov 20, 2016
1 parent 05cad5d commit c000460
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/io/jare/tk/TkRelay.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import org.takes.Response;
import org.takes.Take;
import org.takes.rq.RqHref;
import org.takes.rs.RsWithHeader;
import org.takes.rs.RsWithHeaders;
import org.takes.tk.TkProxy;

/**
Expand Down Expand Up @@ -100,11 +100,13 @@ public Response act(final Request req) throws IOException {
String.format("domain \"%s\" is not registered", host)
);
}
return new RsWithHeader(
final Domain domain = domains.next();
return new RsWithHeaders(
new TkProxy(uri.toString()).act(
TkRelay.request(req, new Destination(uri).path())
),
String.format("X-Jare-Target: %s", uri)
String.format("X-Jare-Target: %s", uri),
String.format("X-Jare-Usage: %d", domain.usage().total())
);
}

Expand Down

0 comments on commit c000460

Please sign in to comment.