【发布时间】:2018-11-15 23:29:46
【问题描述】:
我请求的 API 响应包含多个页面。在响应的标题中是以我不知道如何处理的格式发送的当前页面和最后一页。所有其他标题都是字符串。例如,如果我请求以下标头:
Request request = new Request.Builder().url(url).head().build();
Response response = client.newCall(request).execute();
return response.header("date").toString();
我得到这个结果:
Wed, 06 Jun 2018 10:00:31 GMT
想要的结果在“链接”标题下,在 Postman 中显示如下:
链接→https://api.schiphol.nl:443/public-flights/airlines?sort=%20publicname&app_id=***&app_key=***&page=7; rel="last", https://api.schiphol.nl:443/public-flights/airlines?sort=%20publicname&app_id=***&app_key=***&page=1; rel="下一个"
当我尝试返回标题“链接”时,我得到一个空指针。我该怎么做?
提前致谢!
【问题讨论】:
标签: java api http response okhttp