Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: honojs/hono
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.11.5
Choose a base ref
...
head repository: honojs/hono
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.11.6
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Dec 13, 2023

  1. fix(context): set status correctly (#1814)

    * fix(context): set `status` correctly
    
    * denoify
    yusukebe authored Dec 13, 2023

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    hi-ogawa Hiroshi Ogawa
    Copy the full SHA
    4c4c4ee View commit details
  2. v3.11.6

    yusukebe committed Dec 13, 2023

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    hi-ogawa Hiroshi Ogawa
    Copy the full SHA
    0e11444 View commit details
Showing with 4 additions and 5 deletions.
  1. +1 −2 deno_dist/context.ts
  2. +1 −1 package.json
  3. +1 −2 src/context.ts
  4. +1 −0 src/middleware/cors/index.test.ts
3 changes: 1 addition & 2 deletions deno_dist/context.ts
Original file line number Diff line number Diff line change
@@ -234,7 +234,7 @@ export class Context<
this.res = new Response(data, arg)
}

let status = typeof arg === 'number' ? arg : this.#status
const status = typeof arg === 'number' ? arg : arg ? arg.status : this.#status
this.#preparedHeaders ??= {}

this.#headers ??= new Headers()
@@ -249,7 +249,6 @@ export class Context<
for (const [k, v] of Object.entries(this.#preparedHeaders)) {
this.#headers.set(k, v)
}
status = this.#res.status
}

headers ??= {}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hono",
"version": "3.11.5",
"version": "3.11.6",
"description": "Ultrafast web framework for the Edges",
"main": "dist/cjs/index.js",
"type": "module",
3 changes: 1 addition & 2 deletions src/context.ts
Original file line number Diff line number Diff line change
@@ -234,7 +234,7 @@ export class Context<
this.res = new Response(data, arg)
}

let status = typeof arg === 'number' ? arg : this.#status
const status = typeof arg === 'number' ? arg : arg ? arg.status : this.#status
this.#preparedHeaders ??= {}

this.#headers ??= new Headers()
@@ -249,7 +249,6 @@ export class Context<
for (const [k, v] of Object.entries(this.#preparedHeaders)) {
this.#headers.set(k, v)
}
status = this.#res.status
}

headers ??= {}
1 change: 1 addition & 0 deletions src/middleware/cors/index.test.ts
Original file line number Diff line number Diff line change
@@ -65,6 +65,7 @@ describe('CORS by Middleware', () => {
it('GET default', async () => {
const res = await app.request('http://localhost/api/abc')

expect(res.status).toBe(200)
expect(res.headers.get('Access-Control-Allow-Origin')).toBe('*')
expect(res.headers.get('Vary')).toBeNull()
})