Skip to content

Commit

Permalink
Updated server dep
Browse files Browse the repository at this point in the history
  • Loading branch information
LatvianModder committed Oct 14, 2024
1 parent 518fa01 commit 4d727e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repositories {
}

dependencies {
compileOnly('dev.latvian.apps:tiny-java-server:1.0.0-build.7')
compileOnly('dev.latvian.apps:tiny-java-server:1.0.0-build.16')
compileOnly('org.jetbrains:annotations:24.0.1')
testImplementation('dev.latvian.apps:ansi:1.0.0-build.1')
testImplementation('org.junit.jupiter:junit-jupiter-api:5.10.0')
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/dev/latvian/apps/json/JSONResponse.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package dev.latvian.apps.json;

import dev.latvian.apps.tinyserver.content.MimeType;
import dev.latvian.apps.tinyserver.http.response.HTTPResponse;
import dev.latvian.apps.tinyserver.http.response.HTTPStatus;

import java.nio.charset.StandardCharsets;

public interface JSONResponse {
HTTPResponse SUCCESS = HTTPStatus.OK.json(JSONObject.of("success", true).toString());
HTTPResponse SUCCESS = of(JSONObject.of("success", true));

static HTTPResponse of(HTTPStatus status, Object json) {
return status.content(JSON.DEFAULT.write(json).getBytes(StandardCharsets.UTF_8), MimeType.JSON);
return status.json(JSON.DEFAULT.write(json));
}

static HTTPResponse of(Object json) {
Expand Down

0 comments on commit 4d727e1

Please sign in to comment.