Skip to content

Commit 6ade99a

Browse files
authored
Merge pull request #1 from ModularSoftAU/fix-httpclient-oom
Fix httpclient oom
2 parents 42c59da + 5abd2a4 commit 6ade99a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.ModularEnigma</groupId>
88
<artifactId>Requests</artifactId>
9-
<version>1.0.3</version>
9+
<version>1.0.4</version>
1010
<packaging>jar</packaging>
1111

1212
<name>ModularEnigma Requests API</name>
@@ -107,4 +107,4 @@
107107
</plugin>
108108
</plugins>
109109
</build>
110-
</project>
110+
</project>

src/main/java/io/github/ModularEnigma/Request.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class Request {
1313
private final Method requestMethod;
1414
private final String requestBody;
1515
private final Map<String, String> headers;
16+
private static final HttpClient client = HttpClient.newHttpClient();
1617

1718
public enum Method {
1819
GET, POST // Add others if desired
@@ -67,7 +68,6 @@ public Response execute() {
6768

6869
// Send the request and listen for a response
6970
HttpRequest request = builder.build();
70-
HttpClient client = HttpClient.newHttpClient();
7171
HttpResponse<String> httpResponse;
7272
try {
7373
httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());

0 commit comments

Comments
 (0)