()
| 67 | } |
| 68 | |
| 69 | public Object proceed() throws Exception { |
| 70 | if (returnType == Response.class) { |
| 71 | return disconnectResponseBodyIfNeeded(response); |
| 72 | } |
| 73 | |
| 74 | try { |
| 75 | final boolean shouldDecodeResponseBody = |
| 76 | (response.status() >= 200 && response.status() < 300) |
| 77 | || (response.status() == 404 && dismiss404 && !isVoidType(returnType)); |
| 78 | |
| 79 | if (!shouldDecodeResponseBody) { |
| 80 | throw decodeError(configKey, response); |
| 81 | } |
| 82 | |
| 83 | if (isVoidType(returnType) && !decodeVoid) { |
| 84 | ensureClosed(response.body()); |
| 85 | return null; |
| 86 | } |
| 87 | |
| 88 | Class<?> rawType = Types.getRawType(returnType); |
| 89 | if (TypedResponse.class.isAssignableFrom(rawType)) { |
| 90 | Type bodyType = Types.resolveLastTypeParameter(returnType, TypedResponse.class); |
| 91 | return TypedResponse.builder(response).body(decode(response, bodyType)).build(); |
| 92 | } |
| 93 | |
| 94 | return decode(response, returnType); |
| 95 | } finally { |
| 96 | if (closeAfterDecode) { |
| 97 | ensureClosed(response.body()); |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | private static Response disconnectResponseBodyIfNeeded(Response response) throws IOException { |
| 103 | final boolean shouldDisconnectResponseBody = |
nothing calls this directly
no test coverage detected