Skip to content

Commit

Permalink
Merge pull request #410 from yanntech/fix/hipchat-urlencode
Browse files Browse the repository at this point in the history
add urlencode in roomId
  • Loading branch information
alenkacz authored Sep 18, 2016
2 parents e40cdd0 + 9c03757 commit 5e1ae22
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import java.util.ArrayList;
import java.util.List;
import java.net.URLEncoder;

import javax.inject.Inject;
import javax.inject.Named;
Expand Down Expand Up @@ -86,10 +87,11 @@ private void sendMessage(String message, MessageColor color, String[] roomIds, S
for (String roomId : roomIds) {
LOGGER.info("Posting: {} to {}: {} {}", from, roomId, message, color);
HttpClient client = HttpClientBuilder.create().useSystemProperties().build();
String url = baseUrl + "/v2/room/" + roomId + "/notification?auth_token=" + authToken;
HttpPost post = new HttpPost(url);
HttpPost post = new HttpPost();

try {
String url = baseUrl + "/v2/room/" + URLEncoder.encode(roomId, "UTF-8").replaceAll("\\+", "%20") + "/notification?auth_token=" + authToken;
post = new HttpPost(url);
List<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>();
parameters.add(new BasicNameValuePair("message", message));
parameters.add(new BasicNameValuePair("color", color.name().toLowerCase()));
Expand Down

0 comments on commit 5e1ae22

Please sign in to comment.