dave
04/17/2020, 3:49 PMfun main() {
data class Pageable(val sortAscending: Boolean, val page: Int, val maxResults: Int)
val lens = Query.composite {
Pageable(
boolean().defaulted("sortAscending", true)(it),
int().defaulted("page", 1)(it),
int().defaulted("maxResults", 20)(it)
)
}
println(lens(Request(GET, "/list?page=1")))
// Pageable(sortAscending=true, page=1, maxResults=20)
}
sp
04/18/2020, 3:59 AMEduardo Narros
04/22/2020, 2:15 PMdave
04/23/2020, 12:40 PMCosmin Victor Celea
04/27/2020, 2:26 PMMehdi
05/01/2020, 11:17 PMUberto Barbini
05/06/2020, 7:36 PMUberto Barbini
05/06/2020, 7:41 PMandyg
05/08/2020, 7:46 AMCosmin Victor Celea
05/11/2020, 1:14 PMSaša Šijak
05/12/2020, 12:27 PMSaša Šijak
05/13/2020, 4:39 AMandyg
05/13/2020, 10:07 AMapplication/json
? Perhaps an equivalent of Flask's jsonify
(https://flask.palletsprojects.com/en/1.1.x/api/#flask.json.jsonify). Thanks.Arnab Datta
05/18/2020, 8:49 AM4.6.0
but the newest version of okhttp is 4.7.0
Is there a recommended upgrade strategy here? Should I wait for http to catch up with okhttp before upgrading both?Alpha Ho
05/22/2020, 6:13 AMMultipartFormBody
, MultipartEntity
, MultipartFormParser
, Part
etc.?
If so, is it possible to reuse some of the existing logic? Because the current http4k-multipart
module seems very specific to multipart/form-data
requests, it feels not very straight-forward to reuse.dave
05/29/2020, 3:16 PMQuy D X Nguyen
05/30/2020, 5:02 PMval client = ApacheClient(responseBodyMode = BodyMode.Stream, client = HttpClients.custom()
.setDefaultRequestConfig(RequestConfig.custom()
.setCookieSpec(CookieSpecs.IGNORE_COOKIES)
.build()).build())
val app = { request: Request ->
val query = Request(Method.GET, "<some url>")
val response = client(query)
Response(Status.OK).body(response.body)
}.asServer(Netty(port)).start()
Now if I use Jetty, the streaming nature works fine. I want to use Netty however, and switching to Netty means all the streaming code is ignored, and no waterfall occurs.Quy D X Nguyen
05/31/2020, 4:32 PMApacheClient
safe to reuse in a handler?Andrew Worley
06/02/2020, 12:29 PMQuy D X Nguyen
06/08/2020, 9:25 PMApacheClient
will just stop querying large files (3Mb) and not close the connection. This leads to thread starvation and eventually an unresponsive app.
val client = ApacheClient(responseBodyMode = BodyMode.Stream, client = HttpClients.custom()
.setDefaultRequestConfig(RequestConfig.custom()
.setCookieSpec(CookieSpecs.IGNORE_COOKIES)
.setConnectTimeout(3000)
.setSocketTimeout(3000)
.build())
.setMaxConnTotal(10)
.build())
I'm just piping the resulting stream directly into a response, and when I augmented the ReadCalls with some printlns, they just suddenly stop after a while - and then my app freezes.
Edit: It can also happen on smaller files. What's important is that the connection doesn't appear to be closed.Mehdi
06/09/2020, 9:20 AMfun routes(): RoutingHttpHandler {
return org.http4k.routing.routes(
"/ping" bind Method.GET to pingHandler,
"foo" bind <http://Method.POST|Method.POST> t fooHandler,
)
}
dave
06/09/2020, 7:05 PMQuy D X Nguyen
06/11/2020, 3:35 AMCosmin Victor Celea
06/11/2020, 8:00 AMGET /api/personer/47120999865 HTTP/2
Host: localhost:8443
User-Agent: curl/7.64.1
Accept: /* Connection state changed (MAX_CONCURRENT_STREAMS == 128)! * TLSv1.2 (IN), TLS alert, close notify (256): * Empty reply from server * Connection #0 to host localhost left intact curl: (52) Empty reply from server * Closing connection 0
krtko
06/15/2020, 7:45 PM3.183.0
to 3.249.0
and I use Undertow in production
About once a day, a single request throw this error io.undertow.request - UT005007: Request was not fully consumed
Any ideas?andyg
06/29/2020, 7:02 AM.cookie(name, val)
results in the cookie values being surrounded by double-quotes. I'm guessing that is usually OK but is it possible to create the Cookie header without the double-quotes for some fussy servers? (other than creating my own list of k-v pairs and joining the string manually). Thankspabl0rg
07/01/2020, 4:31 PMCosmin Victor Celea
07/08/2020, 1:56 PMcontexts[request]
Any ideas?andyg
07/24/2020, 3:17 AMApacheClient()
... which is stuck on "DEBUG" log level and thus prints huge amounts of output. Tried to change with (LoggerFactory.getLogger(ApacheClient::class.java) as ch.qos.logback.classic.Logger).level = Level.ERROR
but no luck. Any ideas on changing the client log level? Thanks.Sandyzwin6
08/04/2020, 11:22 AMval client: HttpHandler = ApacheClient(responseBodyMode = BodyMode.Stream)
client(invoke(Method.GET, url)).use { response ->
assertEquals(Status.OK, response.status)
validateReadings(response, 1, instant(from), instant(to))
}
Sandyzwin6
08/04/2020, 11:22 AMval client: HttpHandler = ApacheClient(responseBodyMode = BodyMode.Stream)
client(invoke(Method.GET, url)).use { response ->
assertEquals(Status.OK, response.status)
validateReadings(response, 1, instant(from), instant(to))
}
s4nchez
08/04/2020, 11:55 AMSandyzwin6
08/04/2020, 1:41 PMuse
on a Closeable, which is the normal pattern and AFAIK the contract of a Closeable, does not close the resource but hangs. I can simply ignore this because it is only a test and what I actually want to test works fine, but to be honest this doesn't seem right.s4nchez
08/04/2020, 1:45 PMSandyzwin6
08/04/2020, 1:46 PMs4nchez
08/04/2020, 1:47 PMSandyzwin6
08/04/2020, 1:52 PMStreamingResponseBody
So looking for the reason in that stuff will be like looking for a needle in a haystack. Why use Spring? Why Indeed... Not my choice :-(s4nchez
08/04/2020, 1:55 PM