Skip to content
Myr

fix(context): set `status` correctly (#1814)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* fix(context): set `status` correctly * denoify

authored by Yusuke Wada · committed by GitHub · parent a86b75b · Browse files · 3 files+3 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+3 added−4 removed

  • tests:+1 added−0 removed
  • other:+2 added−4 removed

3 files+3 added−4 removed

modified:deno_dist/context.ts+1 added-2 removed
232 unmodified lines
233 if (arg && typeof arg !== 'number') {234 this.res = new Response(data, arg)235 }236237 let status = typeof arg === 'number' ? arg : this.#status237 const status = typeof arg === 'number' ? arg : arg ? arg.status : this.#status238 this.#preparedHeaders ??= {}239240 this.#headers ??= new Headers()241 for (const [k, v] of Object.entries(this.#preparedHeaders)) {
6 unmodified lines
248 })249 for (const [k, v] of Object.entries(this.#preparedHeaders)) {250 this.#headers.set(k, v)251 }252 status = this.#res.status252 }253254 headers ??= {}255 for (const [k, v] of Object.entries(headers)) {
218 unmodified lines
modified:src/middleware/cors/index.test.ts+1 added
modified:src/context.ts+1 added-2 removed
232 unmodified lines
233 if (arg && typeof arg !== 'number') {234 this.res = new Response(data, arg)235 }236237 let status = typeof arg === 'number' ? arg : this.#status237 const status = typeof arg === 'number' ? arg : arg ? arg.status : this.#status238 this.#preparedHeaders ??= {}239240 this.#headers ??= new Headers()241 for (const [k, v] of Object.entries(this.#preparedHeaders)) {
6 unmodified lines
248 })249 for (const [k, v] of Object.entries(this.#preparedHeaders)) {250 this.#headers.set(k, v)251 }252 status = this.#res.status252 }253254 headers ??= {}255 for (const [k, v] of Object.entries(headers)) {
218 unmodified lines