You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When sending a request having the logbook-ktor-server plugin installed, the Content-Type String value is not correctly retrieved.
An example of a consequence of this is that when configuring a formatter like the JsonHttpLogFormatter, the request body won't be printed as JSON, but plain text instead (with \n characters)
Expected Behavior
The Content-Type header string value should be correct (ex: application/json)
Actual Behavior
The Content-Type header string value is incorrect (ex: application instead of application/json)
Possible Fix
Replace .contentType with .toString() when retrieving the content type String value.
If you uncomment the line 28 and test with com.grassehh.logbook.LogbookServer instead, it will be printed correctly:
"body": {
"name": "John Doe",
"age": 25
}
Context
I changed my formatter to JsonHttpLogFormatter then in Datadog, I noticed my JSON request body were no longer indexed because it was treated as a plain text instead of an actual JSON.
Your Environment
Ktor 2.3.10
Logbook 3.8.0
The text was updated successfully, but these errors were encountered:
Description
When sending a request having the
logbook-ktor-server
plugin installed, theContent-Type
String value is not correctly retrieved.An example of a consequence of this is that when configuring a formatter like the
JsonHttpLogFormatter
, the request body won't be printed as JSON, but plain text instead (with\n
characters)Expected Behavior
The
Content-Type
header string value should be correct (ex:application/json
)Actual Behavior
The
Content-Type
header string value is incorrect (ex:application
instead ofapplication/json
)Possible Fix
Replace
.contentType
with.toString()
when retrieving the content type String value.Steps to Reproduce
ServerTest
test class inside the zalando-logbook-1823 folderIf you read the request log, the body will look like this:
If you uncomment the line 28 and test with
com.grassehh.logbook.LogbookServer
instead, it will be printed correctly:Context
I changed my formatter to
JsonHttpLogFormatter
then in Datadog, I noticed my JSON request body were no longer indexed because it was treated as a plain text instead of an actual JSON.Your Environment
Ktor 2.3.10
Logbook 3.8.0
The text was updated successfully, but these errors were encountered: