(String link)
| 42 | } |
| 43 | |
| 44 | public static Response HEAD(String link) { |
| 45 | try { |
| 46 | URL url = new URL(link); |
| 47 | HttpURLConnection connection = (HttpURLConnection) url.openConnection(); |
| 48 | connection.setRequestMethod("HEAD"); |
| 49 | connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"); |
| 50 | connection.setRequestProperty("Accept", "*/*"); |
| 51 | connection.setRequestProperty("Connection", "keep-alive"); |
| 52 | |
| 53 | connection.setUseCaches(false); |
| 54 | connection.connect(); |
| 55 | |
| 56 | Response response = new Response(); |
| 57 | response.statusCode = connection.getResponseCode(); |
| 58 | response.headers = connection.getHeaderFields(); |
| 59 | response.body = connection.getInputStream().readAllBytes(); |
| 60 | |
| 61 | connection.getInputStream().close(); |
| 62 | |
| 63 | return response; |
| 64 | } catch (IOException e) { |
| 65 | return null; |
| 66 | } |
| 67 | |
| 68 | |
| 69 | } |
| 70 | |
| 71 | public static Response GET(String link, String cookies) { |
| 72 | try { |
nothing calls this directly
no outgoing calls
no test coverage detected