aboutsummaryrefslogtreecommitdiff
path: root/juick-api
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-09-05 14:08:59 +0300
committerGravatar Vitaly Takmazov2017-09-05 14:08:59 +0300
commit835482fba474cae7b9bdc714f4552f669458482b (patch)
treebafdad4a2a7e14e7560a9646d4496953abaf7412 /juick-api
parent4ea29d56746b764d14838b64d43ca1358557b50f (diff)
api: parse telegram update from stream
Diffstat (limited to 'juick-api')
-rw-r--r--juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java b/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java
index dc10ceba..4496f6a3 100644
--- a/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java
+++ b/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java
@@ -24,7 +24,6 @@ import com.juick.service.UserService;
import com.pengrad.telegrambot.BotUtils;
import com.pengrad.telegrambot.model.Message;
import com.pengrad.telegrambot.model.Update;
-import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
@@ -36,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.inject.Inject;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.List;
@@ -56,7 +56,7 @@ public class TelegramWebhook {
@RequestMapping(value = "/tlgmbtwbhk", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.OK)
public void processUpdate(InputStream body) throws IOException {
- Update update = BotUtils.parseUpdate(IOUtils.toString(body, StandardCharsets.UTF_8));
+ Update update = BotUtils.parseUpdate(new InputStreamReader(body, StandardCharsets.UTF_8));
Message message = update.message();
if (update.message() == null) {
message = update.editedMessage();