ChallengeServerClient.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:tdl-runner-scala 作者:
String sendAction(String action) throws
        ClientErrorException, ServerErrorException, OtherCommunicationException {
    try {
        String encodedPath = URLEncoder.encode(this.journeyId, "UTF-8");
        String url = String.format("http://%s:%d/action/%s/%s", this.url, port, action, encodedPath);
        HttpResponse<String> response =  Unirest.post(url)
                .header("Accept", this.acceptHeader)
                .header("Accept-Charset", "UTF-8")
                .asString();
        ensureStatusOk(response);
        return response.getBody();
    } catch (UnirestException | UnsupportedEncodingException e ) {
        throw new OtherCommunicationException("Could not perform POST request",e);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号