设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 软件追踪 查看内容

okhttp 3.3.1发布,HTTP+SPDY客户端开发包

2016-5-30 21:01| 发布者: joejoe0332| 查看: 975| 评论: 0|原作者: oschina|来自: oschina

摘要: okhttp 3.3.1 发布,该版本主要是 Bug 修复,包括:Fix: The plaintext check in HttpLoggingInterceptor incorrectly classified newline characters as control characters. This is fixed.Fix: Don't crash readi ...

okhttp 3.3.1 发布,该版本主要是 Bug 修复,包括:

  • Fix: The plaintext check in HttpLoggingInterceptor incorrectly classified newline characters as control characters. This is fixed.

  • Fix: Don't crash reading non-ASCII characters in HTTP/2 headers or in cached HTTP headers.

  • Fix: Retain the response body when an attempt to open a web socket returns a non-101 response code.

okhttp 是一个 Java 的 HTTP+SPDY 客户端开发包,同时也支持 Android。

示例代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
    OkHttpClient client = new OkHttpClient();
 
    String get(URL url) throws IOException {
      HttpURLConnection connection = client.open(url);
      InputStream in = null;
      try {
        // Read the response.
        in = connection.getInputStream();
        byte[] response = readFully(in);
        return new String(response, "UTF-8");
      finally {
        if (in != null) in.close();
      }
    }



酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部