我正在 newsApi 上使用改造。我正在尝试到达终点
https://newsapi.org/v2/sources?apiKey=xxxxx
如果 API 密钥服务器返回错误:
{"status":"error","code":"apiKeyInvalid","message":"Your API key is invalid or incorrect. Check your key, or go to https://newsapi.org to create a free API key."}
如果没有 api 密钥服务器返回:
{“status”:“error”,“code”:“apiKeyMissing”,“message”:“Your API key is missing. Append this to the URL with the apiKey param, or use the x-api-key HTTP header.”}
但在我的应用程序中,改造在这两种情况下都会返回以下内容:
Response{protocol=http/1.1, code=401, message=Unauthorized, url=https://newsapi.org/v2/sources}
两种情况只是网址发生了变化,但消息和代码是相同的。
为什么 Retrofit 会修改服务器响应以及如何获取原始服务器消息或响应?
提前致谢。