File tree 2 files changed +3
-6
lines changed
src/main/java/dev/latvian/apps/json
2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ repositories {
28
28
}
29
29
30
30
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 ' )
32
32
compileOnly(' org.jetbrains:annotations:24.0.1' )
33
33
testImplementation(' dev.latvian.apps:ansi:1.0.0-build.1' )
34
34
testImplementation(' org.junit.jupiter:junit-jupiter-api:5.10.0' )
Original file line number Diff line number Diff line change 1
1
package dev .latvian .apps .json ;
2
2
3
- import dev .latvian .apps .tinyserver .content .MimeType ;
4
3
import dev .latvian .apps .tinyserver .http .response .HTTPResponse ;
5
4
import dev .latvian .apps .tinyserver .http .response .HTTPStatus ;
6
5
7
- import java .nio .charset .StandardCharsets ;
8
-
9
6
public interface JSONResponse {
10
- HTTPResponse SUCCESS = HTTPStatus . OK . json (JSONObject .of ("success" , true ). toString ( ));
7
+ HTTPResponse SUCCESS = of (JSONObject .of ("success" , true ));
11
8
12
9
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 ));
14
11
}
15
12
16
13
static HTTPResponse of (Object json ) {
You can’t perform that action at this time.
0 commit comments