Skip to content

chore(april-fool): change hono is cool to hono is hot #4035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 1, 2025
Merged
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ I want to write the code as I like.
So, if you propose great ideas, but I do not appropriate them, the idea may not be accepted.

Although, don't worry!
Hono is tested well, polished by the contributors, and used by many developers. And I'll try my best to make Hono cool, beautiful, and ultrafast.
Hono is tested well, polished by the contributors, and used by many developers. And I'll try my best to make Hono cool and hot, beautiful, and ultrafast.

## Installing dependencies

Expand Down
4 changes: 2 additions & 2 deletions runtime-tests/deno/middleware.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Deno.test('Basic Auth Middleware', async () => {
const app = new Hono()

const username = 'hono'
const password = 'acoolproject'
const password = 'ahotproject'

app.use(
'/auth/*',
Expand All @@ -29,7 +29,7 @@ Deno.test('Basic Auth Middleware', async () => {
assertEquals(res.status, 401)
assertEquals(await res.text(), 'Unauthorized')

const credential = 'aG9ubzphY29vbHByb2plY3Q='
const credential = 'aG9ubzphaG90cHJvamVjdA=='

const req = new Request('http://localhost/auth/a')
req.headers.set('Authorization', `Basic ${credential}`)
Expand Down
1 change: 0 additions & 1 deletion runtime-tests/lambda-edge/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable quotes */
import type {
Callback,
CloudFrontConfig,
Expand Down
10 changes: 5 additions & 5 deletions src/adapter/cloudflare-pages/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function createEventContext(
env: {
...context.env,
ASSETS: { fetch: vi.fn(), ...context.env?.ASSETS },
TOKEN: context.env?.TOKEN ?? 'HONOISCOOL',
TOKEN: context.env?.TOKEN ?? 'HONOISHOT',
},
functionPath: '_worker.js',
next: vi.fn(),
Expand All @@ -35,7 +35,7 @@ describe('Adapter for Cloudflare Pages', () => {
const request = new Request('http://localhost/api/foo')
const env = {
ASSETS: { fetch },
TOKEN: 'HONOISCOOL',
TOKEN: 'HONOISHOT',
}
const waitUntil = vi.fn()
const passThroughOnException = vi.fn()
Expand All @@ -59,7 +59,7 @@ describe('Adapter for Cloudflare Pages', () => {
)
expect(res.status).toBe(200)
expect(await res.json()).toEqual({
TOKEN: 'HONOISCOOL',
TOKEN: 'HONOISHOT',
requestURL: 'http://localhost/api/foo',
})
})
Expand Down Expand Up @@ -250,7 +250,7 @@ describe('serveStatic()', () => {
const request = new Request('http://localhost/foo.png')
const env = {
ASSETS: { fetch: assetsFetch },
TOKEN: 'HONOISCOOL',
TOKEN: 'HONOISHOT',
}

const eventContext = createEventContext({ request, env })
Expand All @@ -269,7 +269,7 @@ describe('serveStatic()', () => {
const request = new Request('http://localhost/foo.png')
const env = {
ASSETS: { fetch: assetsFetch },
TOKEN: 'HONOISCOOL',
TOKEN: 'HONOISHOT',
}

const eventContext = createEventContext({ request, env })
Expand Down
1 change: 0 additions & 1 deletion src/adapter/service-worker/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ beforeAll(() => {
function fetch(this: undefined | typeof globalThis, arg0: string | Request) {
if (this !== globalThis) {
const error = new Error(
// eslint-disable-next-line quotes
"Failed to execute 'fetch' on 'WorkerGlobalScope': Illegal invocation"
)
error.name = 'TypeError'
Expand Down
2 changes: 1 addition & 1 deletion src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ export class Context<
* @example
* ```ts
* app.use('*', async (c, next) => {
* c.set('message', 'Hono is cool!!')
* c.set('message', 'Hono is hot!!')
* await next()
* })
* ```
Expand Down
1 change: 0 additions & 1 deletion src/helper/css/common.case.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable quotes */
/** @jsxImportSource ../../jsx */
import type {
Style as StyleComponent,
Expand Down
2 changes: 1 addition & 1 deletion src/helper/css/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const toHash = (str: string): string => {

const cssStringReStr: string = [
'"(?:(?:\\\\[\\s\\S]|[^"\\\\])*)"', // double quoted string
// eslint-disable-next-line quotes

"'(?:(?:\\\\[\\s\\S]|[^'\\\\])*)'", // single quoted string
].join('|')
const minifyCssRe: RegExp = new RegExp(
Expand Down
8 changes: 3 additions & 5 deletions src/helper/html/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { html, raw } from '.'
describe('Tagged Template Literals', () => {
it('Should escape special characters', () => {
const name = 'John "Johnny" Smith'
// eslint-disable-next-line quotes

expect(html`<p>I'm ${name}.</p>`.toString()).toBe("<p>I'm John &quot;Johnny&quot; Smith.</p>")
})

Expand Down Expand Up @@ -35,7 +35,7 @@ describe('Tagged Template Literals', () => {
const name = Promise.resolve('John "Johnny" Smith')
const res = html`<p>I'm ${name}.</p>`
expect(res).toBeInstanceOf(Promise)
// eslint-disable-next-line quotes

expect((await res).toString()).toBe("<p>I'm John &quot;Johnny&quot; Smith.</p>")
})

Expand All @@ -59,10 +59,9 @@ describe('Tagged Template Literals', () => {
])
const res = html`<p>I'm ${name}.</p>`
expect(res).toBeInstanceOf(Promise)
// eslint-disable-next-line quotes

expect((await res).toString()).toBe("<p>I'm Hono.</p>")
expect(await resolveCallback(await res, HtmlEscapedCallbackPhase.Stringify, false, {})).toBe(
// eslint-disable-next-line quotes
"<p>I'm Hono!.</p>"
)
})
Expand All @@ -73,7 +72,6 @@ describe('raw', () => {
it('Should be marked as escaped.', () => {
const name = 'John &quot;Johnny&quot; Smith'
expect(html`<p>I'm ${raw(name)}.</p>`.toString()).toBe(
// eslint-disable-next-line quotes
"<p>I'm John &quot;Johnny&quot; Smith.</p>"
)
})
Expand Down
3 changes: 1 addition & 2 deletions src/jsx/dom/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const splitRule = (rule: string): string[] => {
const char = rule[i]

// consume quote
// eslint-disable-next-line quotes

if (char === "'" || char === '"') {
const quote = char
i++
Expand All @@ -44,7 +44,6 @@ const splitRule = (rule: string): string[] => {
}

// comments are removed from the rule in advance

if (char === '{') {
depth++
continue
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/basic-auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type BasicAuthOptions =
* '/auth/*',
* basicAuth({
* username: 'hono',
* password: 'acoolproject',
* password: 'ahotproject',
* })
* )
*
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/bearer-auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type BearerAuthOptions =
* ```ts
* const app = new Hono()
*
* const token = 'honoiscool'
* const token = 'honoishot'
*
* app.use('/api/*', bearerAuth({ token }))
*
Expand Down
6 changes: 3 additions & 3 deletions src/middleware/body-limit/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ const buildRequestInit = (init: RequestInit = {}): RequestInit & { duplex: 'half
describe('Body Limit Middleware', () => {
let app: Hono

const exampleText = 'hono is so cool' // 15byte
const exampleText2 = 'hono is so cool and cute' // 24byte
const exampleText = 'hono is so hot' // 14byte
const exampleText2 = 'hono is so hot and cute' // 23byte

beforeEach(() => {
app = new Hono()
app.use('*', bodyLimit({ maxSize: 15 }))
app.use('*', bodyLimit({ maxSize: 14 }))
app.get('/', (c) => c.text('index'))
app.post('/body-limit-15byte', async (c) => {
return c.text(await c.req.raw.text())
Expand Down
4 changes: 2 additions & 2 deletions src/middleware/context-storage/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Context Storage Middleware', () => {

app.use(contextStorage())
app.use(async (c, next) => {
c.set('message', 'Hono is cool!!')
c.set('message', 'Hono is hot!!')
await next()
})
app.get('/', (c) => {
Expand All @@ -25,6 +25,6 @@ describe('Context Storage Middleware', () => {

it('Should get context', async () => {
const res = await app.request('/')
expect(await res.text()).toBe('Hono is cool!!')
expect(await res.text()).toBe('Hono is hot!!')
})
})
2 changes: 1 addition & 1 deletion src/middleware/context-storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const asyncLocalStorage = new AsyncLocalStorage<Context>()
* app.use(contextStorage())
*
* app.use(async (c, next) => {
* c.set('message', 'Hono is cool!!)
* c.set('message', 'Hono is hot!!)
* await next()
* })
*
Expand Down
32 changes: 16 additions & 16 deletions src/middleware/etag/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ describe('Etag Middleware', () => {
const app = new Hono()
app.use('/etag/*', etag())
app.get('/etag/abc', (c) => {
return c.text('Hono is cool')
return c.text('Hono is hot')
})
app.get('/etag/def', (c) => {
return c.json({ message: 'Hono is cool' })
return c.json({ message: 'Hono is hot' })
})
let res = await app.request('http://localhost/etag/abc')
expect(res.headers.get('ETag')).not.toBeFalsy()
expect(res.headers.get('ETag')).toBe('"4e32298b1cb4edc595237405e5b696e105c2399a"')
expect(res.headers.get('ETag')).toBe('"d104fafdb380655dab607c9bddc4d4982037afa1"')

res = await app.request('http://localhost/etag/def')
expect(res.headers.get('ETag')).not.toBeFalsy()
expect(res.headers.get('ETag')).toBe('"4515561204e8269cb4468d5b39288d8f2482dcfe"')
expect(res.headers.get('ETag')).toBe('"67340414f1a52c4669a6cec71f0ae04532b29249"')
})

it('Should return etag header with another algorithm', async () => {
Expand All @@ -35,21 +35,21 @@ describe('Etag Middleware', () => {
})
)
app.get('/etag/abc', (c) => {
return c.text('Hono is cool')
return c.text('Hono is hot')
})
app.get('/etag/def', (c) => {
return c.json({ message: 'Hono is cool' })
return c.json({ message: 'Hono is hot' })
})
let res = await app.request('http://localhost/etag/abc')
expect(res.headers.get('ETag')).not.toBeFalsy()
expect(res.headers.get('ETag')).toBe(
'"ee7e84f92c4f54fec768123ac23003a6eb8437db95bcfbfc35db477af1ccb49e"'
'"ed00834279b4fd5dcdc7ab6a5c9774de8afb2de30da2c8e0f17d0952839b5370"'
)

res = await app.request('http://localhost/etag/def')
expect(res.headers.get('ETag')).not.toBeFalsy()
expect(res.headers.get('ETag')).toBe(
'"6ae7438c67f07b60b2ab069dbce206b00d3528c690840a77e0222d37398a8547"'
'"83b61a767db6e22afea68dd645b4d4597a06276c8ce7f895ad865cf4ab154ec4"'
)
})

Expand Down Expand Up @@ -159,12 +159,12 @@ describe('Etag Middleware', () => {
const app = new Hono()
app.use('/etag/*', etag({ weak: true }))
app.get('/etag/abc', (c) => {
return c.text('Hono is cool')
return c.text('Hono is hot')
})

const res = await app.request('http://localhost/etag/abc')
expect(res.headers.get('ETag')).not.toBeFalsy()
expect(res.headers.get('ETag')).toBe('W/"4e32298b1cb4edc595237405e5b696e105c2399a"')
expect(res.headers.get('ETag')).toBe('W/"d104fafdb380655dab607c9bddc4d4982037afa1"')
})

it('Should handle conditional GETs', async () => {
Expand Down Expand Up @@ -222,11 +222,11 @@ describe('Etag Middleware', () => {
const app = new Hono()
app.use('/etag/*', etag())
app.use('/etag/*', etag())
app.get('/etag/abc', (c) => c.text('Hono is cool'))
app.get('/etag/abc', (c) => c.text('Hono is hot'))

const res = await app.request('http://localhost/etag/abc')
expect(res.headers.get('ETag')).not.toBeFalsy()
expect(res.headers.get('ETag')).toBe('"4e32298b1cb4edc595237405e5b696e105c2399a"')
expect(res.headers.get('ETag')).toBe('"d104fafdb380655dab607c9bddc4d4982037afa1"')
})

it('Should not override ETag headers from upstream', async () => {
Expand All @@ -251,20 +251,20 @@ describe('Etag Middleware', () => {
})
)
app.get('/etag', (c) => {
return c.text('Hono is cool', 200, {
return c.text('Hono is hot', 200, {
'cache-control': cacheControl,
'x-message-retain': message,
'x-message': message,
})
})
const res = await app.request('/etag', {
headers: {
'If-None-Match': '"4e32298b1cb4edc595237405e5b696e105c2399a"',
'If-None-Match': '"d104fafdb380655dab607c9bddc4d4982037afa1"',
},
})
expect(res.status).toBe(304)
expect(res.headers.get('ETag')).not.toBeFalsy()
expect(res.headers.get('ETag')).toBe('"4e32298b1cb4edc595237405e5b696e105c2399a"')
expect(res.headers.get('ETag')).toBe('"d104fafdb380655dab607c9bddc4d4982037afa1"')
expect(res.headers.get('Cache-Control')).toBe(cacheControl)
expect(res.headers.get('x-message-retain')).toBe(message)
expect(res.headers.get('x-message')).toBeFalsy()
Expand All @@ -288,7 +288,7 @@ describe('Etag Middleware', () => {
it('Should not generate etag', async () => {
const app = new Hono()
app.use('/etag/*', etag())
app.get('/etag/no-digest', (c) => c.text('Hono is cool'))
app.get('/etag/no-digest', (c) => c.text('Hono is hot'))
const res = await app.request('/etag/no-digest')
expect(res.status).toBe(200)
expect(res.headers.get('ETag')).toBeNull()
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/etag/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function initializeGenerator(
*
* app.use('/etag/*', etag())
* app.get('/etag/abc', (c) => {
* return c.text('Hono is cool')
* return c.text('Hono is hot')
* })
* ```
*/
Expand Down
12 changes: 6 additions & 6 deletions src/middleware/request-id/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ describe('Request ID Middleware', () => {
it('Should return custom request id', async () => {
const res = await app.request('http://localhost/requestId', {
headers: {
'X-Request-Id': 'hono-is-cool',
'X-Request-Id': 'hono-is-hot',
},
})
expect(res).not.toBeNull()
expect(res.status).toBe(200)
expect(res.headers.get('X-Request-Id')).toBe('hono-is-cool')
expect(await res.text()).toBe('hono-is-cool')
expect(res.headers.get('X-Request-Id')).toBe('hono-is-hot')
expect(await res.text()).toBe('hono-is-hot')
})

it('Should return random request id without using request header', async () => {
Expand Down Expand Up @@ -136,13 +136,13 @@ describe('Request ID Middleware with custom header', () => {
it('Should return custom request id', async () => {
const res = await app.request('http://localhost/requestId', {
headers: {
'Hono-Request-Id': 'hono-is-cool',
'Hono-Request-Id': 'hono-is-hot',
},
})
expect(res).not.toBeNull()
expect(res.status).toBe(200)
expect(res.headers.get('Hono-Request-Id')).toBe('hono-is-cool')
expect(await res.text()).toBe('hono-is-cool')
expect(res.headers.get('Hono-Request-Id')).toBe('hono-is-hot')
expect(await res.text()).toBe('hono-is-hot')
})

it('Should not return request id', async () => {
Expand Down
Loading
Loading