Uberto Barbini
11/28/2019, 9:35 AMRazi Kheir
12/04/2019, 1:49 AM"Unresolved reference. None of the following candidates is applicable because of receiver type mismatch"
I wonder if the issue is me injecting also other things into the handler that returns an HttpHandlerandyg
12/17/2019, 1:21 AMtoCurl()
which might be even more useful, given that Curl clearly identifies headers, form fields, etc with -H
, --data
, etc. Plus Curl is a universal spec, a quick search shows a number of Curl to XXX interpreters in various languages.James Richardson
01/10/2020, 7:22 AMRichyHBM
01/12/2020, 1:40 PMJames Shiell
01/16/2020, 1:36 PMClientFilters.Gzip
currently compresses the request, and decompresses the response. Which is great, but request compression is pretty esoteric (as you can't guarantee the remote end will support it). Secondly, I don't see us setting an accept-encoding:gzip
on the request, which means we shouldn't expect to get GZip back.
As such, I suggest two changes (i.e. I'm happy to do it, but need a sanity check)
a) Change ClientFilters.Gzip
to set accept-encoding:gzip
on request, but not to compress the request
b) Add a new ClientFilters.RequestCompressingGzip
to do the above, and additionally compress the request
Seem fair? Or am I being daft?Razi Kheir
01/20/2020, 5:41 AMCaused by: org.http4k.lens.LensFailure: location 'NON_OPTIONAL_VAR' must be object
at org.http4k.lens.Lens.invoke(lens.kt:17)
at config.CompositeEnvironmentHandler$$special$$inlined$composite$1.invoke(lensSpec.kt:262)
at config.CompositeEnvironmentHandler$$special$$inlined$composite$1.invoke(lensSpec.kt)
at org.http4k.lens.LensGet$invoke$1.invoke(lensSpec.kt:15)
at org.http4k.lens.LensGet$invoke$1.invoke(lensSpec.kt:14)
at org.http4k.lens.LensSpec$required$1.invoke(lensSpec.kt:99)
at org.http4k.lens.Lens.invoke(lens.kt:13)
dave
01/20/2020, 6:51 AMdave
01/20/2020, 7:32 AM@Test
fun `composite can use a mixture of overridden and non overridden values`() {
data class Target(val foo: String, val bar: Int, var foobar: Int?)
val finalEnv = from("bar" to "123") overrides from("FOO" to "bill")
val key = EnvironmentKey.composite {
Target(
required("FOO")(it),
int().required("BAR")(it),
int().optional("FOOBAR")(it)
)
}
assertThat(key(finalEnv), equalTo(Target("bill", 123, null)))
}
}
Razi Kheir
01/24/2020, 6:42 AMRay Eldath
01/26/2020, 6:40 AMresponseLens
and use returning
to specify it in contract route. But I want to know is it possible to constraint and auto-marshalling for request? like
data class LoginRequest(val email: String, val password: String) {
init {
require(EmailValidator.getInstance().isValid(email))
}
}
val requestLens = Body.auto<LoginRequest>("Login essentials.")
fun handler(login: LoginRequest): HttpHandler = { req: Request -> ... }
"/login" / Body.of(requestLens) meta {
...
} bindContract <http://Method.POST|Method.POST> to ::handler
Many thanks.Ray Eldath
01/27/2020, 5:25 AMjacksonObjectMapper().writeValueAsString(e)
to manually convert the object, and it works fine now.
i feel somewhat strange about the origin behavior. use writeValueAsString
will format the stacktrace into a well-organized json but .with(error of e)
will output the stacktrace solely which will crash the json parser. why with
is designed to work in this way...? 😕andyg
01/29/2020, 3:17 AM[XNIO-1 task-12] DEBUG <http://io.undertow.request.io|io.undertow.request.io> - UT005013: An IOException occurred
<http://java.net|java.net>.SocketException: Connection reset
immediately after every request. Have tried various HAProxy options but cannot fix.sp
02/02/2020, 4:07 AMRay Eldath
02/04/2020, 9:35 AMdata class ApproveRequest(val roleId: Int, val extraPermissions: List<InboundPermission> = emptyList())
and
private val requestLens = Body.auto<ApproveRequest>().toLens()
want i want is the field extraPermissions
will be marked as optional
instead of required
in generated OpenApi doc because it have a default value. this may seems somewhat unreasonable, but i just met this in my backend application 😅andyg
02/06/2020, 7:42 AMJordan Terrell
02/07/2020, 2:06 PMjh
02/13/2020, 9:49 AMResponse(OK).body(tempFile.inputStream())
Is there any way to detect when the response has been fully read so that we can then delete the temp file on disk?Mehdi
02/14/2020, 11:47 PMval app = { request: Request -> Response(OK).body("Hello, ${request.query("name")}!") }
val jettyServer = app.asServer(Jetty(9006)).start()
val client = WebsocketClient.blocking(Uri.of("<wss://echo.websocket.org>"), headers = listOf(Pair("a header", "value")))
client.send(WsMessage("hello"))
// read all of the messages from the socket until it is closed (by the server).
// we expect to get one message back before the stream is closed.
client.received().toList().forEach(::println)
I am able to connect but I am not receiving any message. I want to develop a websocket client always send and receive messages to/from the serverAnil
02/27/2020, 4:28 PMs4nchez
03/02/2020, 2:45 PMSandra
03/05/2020, 10:52 AMRay Eldath
03/11/2020, 2:18 PMEmile Achadde
03/19/2020, 3:51 PMCosmin Victor Celea
03/20/2020, 8:44 AMEmile Achadde
03/23/2020, 11:06 AMdave
03/23/2020, 6:09 PMMehdi
03/24/2020, 1:36 PMs4nchez
03/27/2020, 10:18 AM/tokens
path twice. This should work:
class TokensRouter(private val tokensCommandHandler: TokensCommandHandler) {
operator fun invoke(): RoutingHttpHandler =
ServerFilters.Cors(CorsPolicy.UnsafeGlobalPermissive).then(routes(
"/tokens" bind <http://Method.POST|Method.POST> to tokensCommandHandler::invoke
))
}
Cosmin Victor Celea
04/01/2020, 2:24 PMCosmin Victor Celea
04/01/2020, 2:24 PMdave
04/01/2020, 2:26 PMJames Richardson
04/02/2020, 3:24 PM