mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
add status code to server response
This commit is contained in:
parent
e8c7b44e8e
commit
554d39807b
1 changed files with 8 additions and 2 deletions
|
@ -227,13 +227,19 @@ public class Main {
|
|||
}
|
||||
|
||||
public static NettyOutbound writeResponse(HttpServerResponse res, byte[] resp, int code, String cache, long time) {
|
||||
return res.compression(true).addHeader(ACCESS_CONTROL_ALLOW_ORIGIN, "*").addHeader(CACHE_CONTROL, cache)
|
||||
return res.compression(true)
|
||||
.status(code)
|
||||
.addHeader(ACCESS_CONTROL_ALLOW_ORIGIN, "*")
|
||||
.addHeader(CACHE_CONTROL, cache)
|
||||
.addHeader("Server-Timing", "app;dur=" + (System.nanoTime() - time) / 1000000.0)
|
||||
.sendByteArray(Flux.just(resp));
|
||||
}
|
||||
|
||||
public static NettyOutbound writeResponse(HttpServerResponse res, Flux<String> resp, int code, String cache) {
|
||||
return res.compression(true).addHeader(ACCESS_CONTROL_ALLOW_ORIGIN, "*").addHeader(CACHE_CONTROL, cache)
|
||||
return res.compression(true)
|
||||
.status(code)
|
||||
.addHeader(ACCESS_CONTROL_ALLOW_ORIGIN, "*")
|
||||
.addHeader(CACHE_CONTROL, cache)
|
||||
.send(ByteBufFlux.fromString(resp, java.nio.charset.StandardCharsets.UTF_8, ByteBufAllocator.DEFAULT));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue