https://kotlinlang.org logo
#ktor
Title
# ktor
g

gregorbg

05/21/2019, 1:05 PM
Any smart idea on how to intercept and modify cookies from a remote server response before passing them to the
Cookies
feature plugin? At work, we are communicating with an external service that requires cookies but that sends the
Expires
cookie in an incorrect format (i.e. localised, German weekday abbreviations that are only 2 chars long). The
ktor-client
module in our codebase subsequently throws an exception at https://github.com/ktorio/ktor/blob/68eef1948ce4c8c11dae794588f8d063afb67d0b/ktor-http/common/src/io/ktor/http/DateUtils.kt#L20 blocking further development. The communications partner is an enterprise-grade provider, so negotiating with them to just abide by the f*ing standards is not an option, I'm afraid. (Although it's sad that a company like them doesn't care for standards in the first place, but that's totally not my point here.)
1
Currently, our solution is copying the entire sourcecode from the
Cookies
module and modyfing the content before passing them to
fun String.fromHttpToGmtDate
. But arguably, this is even a more horrible solution than SAP not getting their stuff right.
c

cy

05/21/2019, 2:31 PM
The right solution would be to intercept the response pipeline and fix broken header instead of rewriting features. However currently not enough public API to do that (to create a new client call with replaced headers). Could you please file an issue and describe your usecase?
We just decided to fix public API to make it possible.
g

gregorbg

05/21/2019, 3:00 PM
🤩 Thank you, will do!
3 Views