Skip to content

Commit

Permalink
Add UTF-8 support for webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
WD32 authored and robinshine committed Apr 15, 2020
1 parent d038436 commit 5b96253
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.onedev.server.notification;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.ExecutorService;

import javax.inject.Inject;
Expand Down Expand Up @@ -66,10 +67,11 @@ public void run() {
try {
HttpPost httpPost = new HttpPost(webHook.getPostUrl());

StringEntity entity = new StringEntity(jsonOfEvent);
StringEntity entity = new StringEntity(jsonOfEvent, StandardCharsets.UTF_8.name());
httpPost.setEntity(entity);
httpPost.setHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
httpPost.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
httpPost.setHeader(HttpHeaders.ACCEPT_CHARSET, StandardCharsets.UTF_8.name());
httpPost.setHeader(SIGNATURE_HEAD, webHook.getSecret());

CloseableHttpResponse response = client.execute(httpPost);
Expand Down

0 comments on commit 5b96253

Please sign in to comment.