From 704407f913d59c25872b17c9ccdd4e1b54532182 Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Mon, 5 Mar 2018 20:43:23 +0000 Subject: [PATCH] Let's try this --- .../flarebot/webhook_distributor/Sender.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Client/src/main/java/stream/flarebot/webhook_distributor/Sender.java b/Client/src/main/java/stream/flarebot/webhook_distributor/Sender.java index a99bbb4..55edf9d 100644 --- a/Client/src/main/java/stream/flarebot/webhook_distributor/Sender.java +++ b/Client/src/main/java/stream/flarebot/webhook_distributor/Sender.java @@ -28,12 +28,21 @@ public enum Sender { } public static Sender getSender(Request request) { - this.userAgent = request.userAgent(); - for (Sender sender : values) { - if (sender.requestPredicate.test(request)) - return sender; + Sender sender = null; + for (Sender s : values) { + if (s.requestPredicate.test(request)) { + sender = s; + break; + } } - return Sender.UNKNOWN; + if (sender == null) + sender = Sender.UNKNOWN; + sender.setUserAgent(request.userAgent()); + return sender; + } + + private void setUserAgent(String userAgent) { + this.userAgent = userAgent; } public String getUserAgent() {