Carter
02/10/2024, 11:40 AMinstall(ContentEncoding)
block, then it started working again with logs being printed too.
Are there any known issues or limitations with this in Ktor 3.0.0-beta1 or a way to troubleshoot?Aleksei Tirman [JB]
02/12/2024, 8:13 AMCarter
02/12/2024, 12:29 PMAleksei Tirman [JB]
02/12/2024, 12:30 PMCarter
02/12/2024, 12:43 PM[Log] HttpClient: REQUEST: <http://0.0.0.0:8080/conversation> (browser-app-af282e831d4fb1165b6966980f65f7270e7bf93d795bb052749e15756d4f9fc3.js, line 2)
METHOD: HttpMethod(value=POST)
COMMON HEADERS
-> Accept: application/json
-> Accept-Charset: UTF-8
-> Accept-Encoding: gzip;q=1,deflate;q=0.5,identity;q=0
-> Authorization: ***
CONTENT HEADERS
-> Content-Length: 61
-> Content-Type: application/json
BODY Content-Type: application/json
BODY START
{"user_id":"f6ac371b-a042-493f-8418-a074f1f689b1","title":""}
BODY END
I can see the server making this response:
[Log] HttpClient: RESPONSE: 201 Created (browser-app-af282e831d4fb1165b6966980f65f7270e7bf93d795bb052749e15756d4f9fc3.js, line 2)
METHOD: HttpMethod(value=POST)
FROM: <http://0.0.0.0:8080/conversation>
COMMON HEADERS
-> connection: keep-alive
-> content-type: application/json
-> transfer-encoding: Identity
-> x-ratelimit-limit: 20
-> x-ratelimit-remaining: 19
-> x-ratelimit-reset: 1707744514
BODY Content-Type: application/json
BODY START
{"id":"18b05757-0641-45e3-bc2d-3f7202fe99a1","created_at":"2024-02-12T12:28:34.044790Z","value":{"user_id":"f6ac371b-a042-493f-8418-a074f1f689b1","title":""}}
BODY END
From what I can tell, the client is not compressing the request (lack of content-encoding header) but it does say it’ll accept a compressed response. The server is not compressing the response though, using the identity encoding.
The client is configured:
install(ContentEncoding) {
mode = ContentEncodingConfig.Mode.All
gzip(1f)
deflate(0.5f)
identity(0f)
}
The server is configured with:
install(Compression) {
default()
condition {
// For client streaming to work, the response cannot be compressed
// <https://youtrack.jetbrains.com/issue/KTOR-5977>
request.uri != "/${QuestionStreamingPath.ROOT}"
}
excludeContentType(
ContentType.Video.Any,
ContentType.Image.JPEG,
ContentType.Image.PNG,
ContentType.Audio.Any,
ContentType.MultiPart.Any,
ContentType.Text.EventStream
)
}
Aleksei Tirman [JB]
02/12/2024, 1:42 PMCarter
02/12/2024, 1:43 PMCarter
02/12/2024, 1:52 PM