forked from SayHiEveryday/PandaKey-Implement
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequestProvider.java
More file actions
32 lines (28 loc) · 1.1 KB
/
RequestProvider.java
File metadata and controls
32 lines (28 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package me.sallyio.PandaKey.common;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class RequestProvider {
/**
*
* @param uri Url to post
* @return HttpResponse<String>
* @throws URISyntaxException -
* @throws IOException -
* @throws InterruptedException -
*/
public static HttpResponse<String> get(String uri) throws URISyntaxException, IOException, InterruptedException {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI(uri))
.POST(HttpRequest.BodyPublishers.noBody())
.header("x-uptime-check", "sc1pnzhtj9ch54lmabdfglmwvlw7xmbisfmryknnz8")
.header("x-content-type", "c2mxcg5asfrqounontrstufirgzhte1xvkx3n3hnyklzzm1swutotitaod0")
.header("user-agent", "pandaauth")
.build();
return client.send(request, HttpResponse.BodyHandlers.ofString());
}
}