Skip to content

Commit 27fdaf1

Browse files
committed
Merge pull request #278 from jekh/allow-bandwidth-limit-in-bytes
uAllow Upstream/downstream bandwidth limits in bytes/sec in REST API
2 parents 451ff20 + a537f19 commit 27fdaf1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

browsermob-rest/src/main/java/net/lightbody/bmp/proxy/bricks/ProxyResource.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,13 +403,29 @@ public Reply<?> limit(@Named("port") int port, Request<String> request) {
403403
streamManager.enable();
404404
} catch (NumberFormatException e) { }
405405
}
406+
407+
String upstreamBps = request.param("upstreamBps");
408+
if (upstreamBps != null) {
409+
try {
410+
((BrowserMobProxy) proxy).setWriteBandwidthLimit(Integer.parseInt(upstreamBps));
411+
} catch (NumberFormatException e) {}
412+
}
413+
406414
String downstreamKbps = request.param("downstreamKbps");
407415
if (downstreamKbps != null) {
408416
try {
409417
streamManager.setDownstreamKbps(Integer.parseInt(downstreamKbps));
410418
streamManager.enable();
411419
} catch (NumberFormatException e) { }
412420
}
421+
422+
String downstreamBps = request.param("downstreamBps");
423+
if (downstreamBps != null) {
424+
try {
425+
((BrowserMobProxy) proxy).setReadBandwidthLimit(Integer.parseInt(downstreamBps));
426+
} catch (NumberFormatException e) {}
427+
}
428+
413429
String upstreamMaxKB = request.param("upstreamMaxKB");
414430
if (upstreamMaxKB != null) {
415431
try {

0 commit comments

Comments
 (0)