My request gets an unauthorized via ktor, but work...
# ktor
r
My request gets an unauthorized via ktor, but works via httpie:
Copy code
2024-03-15 15:26:48.224 [eventLoopGroupProxy-4-1]  TRACE i.k.server.engine.DefaultTransform - No Default Transformations found for class io.ktor.utils.io.ByteBufferChannel and expected type TypeInfo(type=class net.familycards.plugins.HashedPasswords, reifiedType=class net.familycards.plugins.HashedPasswords, kotlinType=net.familycards.plugins.HashedPasswords) for call /users
2024-03-15 15:26:48.356 [eventLoopGroupProxy-4-1]  TRACE i.k.c.p.c.ContentNegotiation - Adding Accept=application header for <http://guest:guest@localhost:15672/api/vhosts/bfd7e17b-a95b-476a-b022-cafcc9f57d99>
2024-03-15 15:26:48.393 [eventLoopGroupProxy-4-1]  TRACE i.k.c.p.c.ContentNegotiation - Converted request body using io.ktor.serialization.kotlinx.KotlinxSerializationConverter@7f6cc440 for <http://guest:guest@localhost:15672/api/vhosts/bfd7e17b-a95b-476a-b022-cafcc9f57d99>
2024-03-15 15:26:48.393 [eventLoopGroupProxy-4-1]  TRACE i.ktor.client.plugins.HttpPlainText - Adding Accept-Charset=UTF-8 to <http://guest:guest@localhost:15672/api/vhosts/bfd7e17b-a95b-476a-b022-cafcc9f57d99>
2024-03-15 15:26:48.394 [eventLoopGroupProxy-4-1]  TRACE i.k.c.plugins.defaultTransformers - Transformed with default transformers request body for <http://guest:guest@localhost:15672/api/vhosts/bfd7e17b-a95b-476a-b022-cafcc9f57d99> from class io.ktor.http.content.TextContent
2024-03-15 15:26:48.472 [eventLoopGroupProxy-4-1]  TRACE i.k.client.plugins.HttpCallValidator - Validating response for request <http://guest:guest@localhost:15672/api/vhosts/bfd7e17b-a95b-476a-b022-cafcc9f57d99>
2024-03-15 15:26:48.473 [eventLoopGroupProxy-4-1]  TRACE i.k.c.p.DefaultResponseValidation - Skipping default response validation for <http://guest:guest@localhost:15672/api/vhosts/bfd7e17b-a95b-476a-b022-cafcc9f57d99>
2024-03-15 15:26:48.484 [eventLoopGroupProxy-4-1]  TRACE i.k.c.p.c.ContentNegotiation - Response doesn't have "Content-Type" header, skipping ContentNegotiation plugin
2024-03-15 15:26:48.484 [eventLoopGroupProxy-4-1]  TRACE i.k.c.plugins.defaultTransformers - Transformed with default transformers response body for <http://guest:guest@localhost:15672/api/vhosts/bfd7e17b-a95b-476a-b022-cafcc9f57d99> to class io.ktor.utils.io.core.ByteReadPacket
2
And httpie:
Copy code
http PUT <http://guest:guest@localhost:15672/api/vhosts/bfd7e17b-a95b-476a-b022-cafcc9f57d9a> default_queue_type=classic
HTTP/1.1 201 Created
content-length: 0
content-security-policy: script-src 'self' 'unsafe-eval' 'unsafe-inline'; object-src 'self'
date: Fri, 15 Mar 2024 14:27:34 GMT
server: Cowboy
vary: accept, accept-encoding, origin
a
Can you share the Ktor code and describe what kind of authentication is required?
r
Ah, I had to push
basicAuth
manually, now it works fine