Conversation
fix: loading static files
Author
|
@yusukebe |
Member
|
Hi @houssems. Thank you for creating a pull request! Should we accept thenable?When the following code was executed in Deno and "wrangler," a message was displayed. Bun caused an error. import { Hono } from 'hono'
const app = new Hono()
app.get('/', () => {
const res = {
then(resolve) {
setTimeout(() => {
resolve(new Response('Hello from thenable!'))
}, 1000);
}
}
return res as Promise<Response>
})
export default appAs the type indicates, Hono is originally expecting an instance of "Promise", but I think it's okay to accept a thenable even if it's not an instance of "Promise".
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
I'm working in Angular 19 SSR integration with Hono. While investigating a server crash on the loading of static files, I discovered that it didn't wait for the res object to get resolved. So status attribute doesn't exist in Res object. The issue is from instanceof Promise.
RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: undefined at ServerResponse.writeHead (node:_http_server:351:11) at Hn (/dist/server/server.mjs:89:11) at Server.<anonymous> (/dist/server/server.mjs:91:554) at Server.emit (node:events:519:28) at parserOnIncoming (node:_http_server:1141:12) at HTTPParser.parserOnHeadersComplete (node:_http_common:118:17) { code: 'ERR_HTTP_INVALID_STATUS_CODE' }