Skip to content

Commit 4d727e1

Browse files
committed
Updated server dep
1 parent 518fa01 commit 4d727e1

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repositories {
2828
}
2929

3030
dependencies {
31-
compileOnly('dev.latvian.apps:tiny-java-server:1.0.0-build.7')
31+
compileOnly('dev.latvian.apps:tiny-java-server:1.0.0-build.16')
3232
compileOnly('org.jetbrains:annotations:24.0.1')
3333
testImplementation('dev.latvian.apps:ansi:1.0.0-build.1')
3434
testImplementation('org.junit.jupiter:junit-jupiter-api:5.10.0')

src/main/java/dev/latvian/apps/json/JSONResponse.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
package dev.latvian.apps.json;
22

3-
import dev.latvian.apps.tinyserver.content.MimeType;
43
import dev.latvian.apps.tinyserver.http.response.HTTPResponse;
54
import dev.latvian.apps.tinyserver.http.response.HTTPStatus;
65

7-
import java.nio.charset.StandardCharsets;
8-
96
public interface JSONResponse {
10-
HTTPResponse SUCCESS = HTTPStatus.OK.json(JSONObject.of("success", true).toString());
7+
HTTPResponse SUCCESS = of(JSONObject.of("success", true));
118

129
static HTTPResponse of(HTTPStatus status, Object json) {
13-
return status.content(JSON.DEFAULT.write(json).getBytes(StandardCharsets.UTF_8), MimeType.JSON);
10+
return status.json(JSON.DEFAULT.write(json));
1411
}
1512

1613
static HTTPResponse of(Object json) {

0 commit comments

Comments
 (0)