tcurdt
tcurdt
Explore posts from servers
HHono
Created by tcurdt on 5/24/2024 in #help
[solved] HtmlEscapedString not rendering?
A little weird there is not giving a type error.
3 replies
HHono
Created by tcurdt on 5/24/2024 in #help
[solved] HtmlEscapedString not rendering?
This is because render() returns a reponse - not a HtmlEscapedString.
3 replies
HHono
Created by tcurdt on 5/24/2024 in #help
[solved] return type of request handler
So it's either
async function render(c) : Promise<HtlEscapedString> {
return (<body/>)
}

.get('/bar', async (c) => {
return c.html(render(c))
})
async function render(c) : Promise<HtlEscapedString> {
return (<body/>)
}

.get('/bar', async (c) => {
return c.html(render(c))
})
or
async function render(c) : Promise<Response> {
return c.html(<body/>)
}

.get('/bar', async (c) => {
return render(c)
})
async function render(c) : Promise<Response> {
return c.html(<body/>)
}

.get('/bar', async (c) => {
return render(c)
})
8 replies
HHono
Created by tcurdt on 5/24/2024 in #help
[solved] return type of request handler
OK, I get it now
No overload matches this call.
The last overload gave the following error.
Argument of type '(c: Context<Env, "/bar", BlankInput>) => Promise<HtmlEscapedString>' is not assignable to parameter of type 'H<Env, "/bar", BlankInput, HandlerResponse<any>>'.
Type '(c: Context<Env, "/bar", BlankInput>) => Promise<HtmlEscapedString>' is not assignable to type 'MiddlewareHandler<Env, "/bar", BlankInput>'.
Type 'Promise<HtmlEscapedString>' is not assignable to type 'Promise<void | Response>'.
Type 'HtmlEscapedString' is not assignable to type 'void | Response'.
No overload matches this call.
The last overload gave the following error.
Argument of type '(c: Context<Env, "/bar", BlankInput>) => Promise<HtmlEscapedString>' is not assignable to parameter of type 'H<Env, "/bar", BlankInput, HandlerResponse<any>>'.
Type '(c: Context<Env, "/bar", BlankInput>) => Promise<HtmlEscapedString>' is not assignable to type 'MiddlewareHandler<Env, "/bar", BlankInput>'.
Type 'Promise<HtmlEscapedString>' is not assignable to type 'Promise<void | Response>'.
Type 'HtmlEscapedString' is not assignable to type 'void | Response'.
c.html() returns a response and hence the mismatch.
8 replies
HHono
Created by tcurdt on 5/24/2024 in #help
[solved] route param validation with zod
Thanks for the help!
8 replies
HHono
Created by tcurdt on 5/24/2024 in #help
[solved] route param validation with zod
But that works, too
8 replies
HHono
Created by tcurdt on 5/24/2024 in #help
[solved] route param validation with zod
Would be nice if it would.
8 replies
HHono
Created by tcurdt on 5/24/2024 in #help
[solved] route param validation with zod
I assumed that the zValidator middleware would handle this by default
8 replies
HHono
Created by tcurdt on 5/24/2024 in #help
[solved] route param validation with zod
Perfect id: z.coerce.number() was the trick.
8 replies
HHono
Created by tcurdt on 5/24/2024 in #help
[solved] return type of request handler
but the tooling complains in 2)
8 replies
HHono
Created by tcurdt on 5/24/2024 in #help
[solved] return type of request handler
yet it works in 1)
8 replies
HHono
Created by tcurdt on 5/24/2024 in #help
[solved] return type of request handler
It seems like Promise<HtlEscapedString> is not a type that is valid to return
8 replies
HHono
Created by tcurdt on 5/24/2024 in #help
[solved] return type of request handler
Thanks, @Nico ... that wasn't the really the question though ... sorry, for the comment ... let me adjust this
8 replies
CDCloudflare Developers
Created by tcurdt on 2/26/2024 in #pages-discussions
Hey there, anyone a clue how to track
Thanks for the response! Let's move the discussion to the help thread.
2 replies
CDCloudflare Developers
Created by tcurdt on 2/27/2024 in #pages-help
Cloudflare pages very slow
That said, with 380k/s it's currently 10x faster than the slow times I have seen.
7 replies
CDCloudflare Developers
Created by tcurdt on 2/27/2024 in #pages-help
Cloudflare pages very slow
But on the response I don't see any server timings:
* [HTTP/2] [1] OPENED stream for https://torstencurdt.com/assets/img/torstencurdt.png
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: torstencurdt.com]
* [HTTP/2] [1] [:path: /assets/img/torstencurdt.png]
* [HTTP/2] [1] [user-agent: curl/8.4.0]
* [HTTP/2] [1] [accept: */*]
> GET /assets/img/torstencurdt.png HTTP/2
> Host: torstencurdt.com
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/2 200
< date: Wed, 28 Feb 2024 11:05:49 GMT
< content-type: image/png
< content-length: 272372
< access-control-allow-origin: *
< cache-control: public, max-age=0, must-revalidate
< etag: "2fb774ab337bfccc5808a0dfb9836553"
< referrer-policy: strict-origin-when-cross-origin
< x-content-type-options: nosniff
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=kcETRjFoZQ4k2tVuB5LZJuxtr3mhfikHxrLBusnLzPc%2Fiih6Q037u1491SuDfYYKB8OVNL9f%2B1OHqc0oyf4HVGxYNqXcjf5bYsqKZiHglfKGdkiAwZLp53MtqJCwGxh%2B1uK8"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< vary: Accept-Encoding
< cf-cache-status: REVALIDATED
< accept-ranges: bytes
< server: cloudflare
< cf-ray: 85c831d368cc4219-EWR
< alt-svc: h3=":443"; ma=86400
<
{ [6836 bytes data]
* [HTTP/2] [1] OPENED stream for https://torstencurdt.com/assets/img/torstencurdt.png
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: torstencurdt.com]
* [HTTP/2] [1] [:path: /assets/img/torstencurdt.png]
* [HTTP/2] [1] [user-agent: curl/8.4.0]
* [HTTP/2] [1] [accept: */*]
> GET /assets/img/torstencurdt.png HTTP/2
> Host: torstencurdt.com
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/2 200
< date: Wed, 28 Feb 2024 11:05:49 GMT
< content-type: image/png
< content-length: 272372
< access-control-allow-origin: *
< cache-control: public, max-age=0, must-revalidate
< etag: "2fb774ab337bfccc5808a0dfb9836553"
< referrer-policy: strict-origin-when-cross-origin
< x-content-type-options: nosniff
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=kcETRjFoZQ4k2tVuB5LZJuxtr3mhfikHxrLBusnLzPc%2Fiih6Q037u1491SuDfYYKB8OVNL9f%2B1OHqc0oyf4HVGxYNqXcjf5bYsqKZiHglfKGdkiAwZLp53MtqJCwGxh%2B1uK8"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< vary: Accept-Encoding
< cf-cache-status: REVALIDATED
< accept-ranges: bytes
< server: cloudflare
< cf-ray: 85c831d368cc4219-EWR
< alt-svc: h3=":443"; ma=86400
<
{ [6836 bytes data]
7 replies
CDCloudflare Developers
Created by tcurdt on 2/27/2024 in #pages-help
Cloudflare pages very slow
$ curl -o /dev/null -s https://torstencurdt.com/assets/img/torstencurdt.png


==== cURL measurements stats ====
total: 0.718166 seconds
size: 272372 bytes
dnslookup: 0.046982 seconds
connect: 0.157048 seconds
appconnect: 0.280002 seconds
redirect: 0.000000 seconds
pretransfer: 0.280193 seconds
starttransfer: 0.414308 seconds
downloadspeed: 379260 byte/sec
uploadspeed: 0 byte/sec
$ curl -o /dev/null -s https://torstencurdt.com/assets/img/torstencurdt.png


==== cURL measurements stats ====
total: 0.718166 seconds
size: 272372 bytes
dnslookup: 0.046982 seconds
connect: 0.157048 seconds
appconnect: 0.280002 seconds
redirect: 0.000000 seconds
pretransfer: 0.280193 seconds
starttransfer: 0.414308 seconds
downloadspeed: 379260 byte/sec
uploadspeed: 0 byte/sec
7 replies
CDCloudflare Developers
Created by tcurdt on 2/27/2024 in #pages-help
Cloudflare pages very slow
I dug a bit deeper with some curl stats:
7 replies
CDCloudflare Developers
Created by tcurdt on 2/27/2024 in #pages-help
Cloudflare pages very slow
I must be missing something. I don't see the server timing header.
7 replies