elysiajs / elysia

Ergonomic Framework for Humans
https://elysiajs.com
MIT License
10.3k stars 219 forks source link

PATCH request: 501 / "elysia.js/swagger" is not getting a PATCH request. #862

Open moon-kun-woong opened 2 weeks ago

moon-kun-woong commented 2 weeks ago

What version of Elysia is running?

1.0.5 / latest version

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?


export default {
  async fetch(request: Request): Promise<Response> {
    return await app().fetch(request);
  },
} satisfies ExportedHandler<Env>;```

============

```import Elysia, { AnyElysia } from "elysia"
import swagger from "@elysiajs/swagger";

export function app(): AnyElysia {
    const app = new Elysia({ aot: false })
        .use(swagger())
        .group("/all", app =>
            app
            .get('/get', () => 'GET>>>>')
            .post('/post', () => 'POST>>>>')
            .put('/put', () => 'PUT>>>>')
            .patch('/patch', () => 'PATCH>>>>')
            .delete('/delete', () => 'DELETE>>>>')
        )
    return app
}

======


{
  "name": "test-patch",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "deploy": "wrangler deploy",
    "dev": "wrangler dev",
    "start": "wrangler dev",
    "test": "vitest",
    "cf-typegen": "wrangler types",
    "migration:generate": "drizzle-kit generate"
  },
  "devDependencies": {
    "@cloudflare/vitest-pool-workers": "^0.4.5",
    "@cloudflare/workers-types": "^4.20240806.0",
    "@eslint/js": "^9.9.0",
    "drizzle-kit": "^0.24.0",
    "eslint": "^9.9.0",
    "globals": "^15.9.0",
    "typescript": "^5.5.2",
    "typescript-eslint": "^8.1.0",
    "vitest": "1.5.0",
    "wrangler": "^3.60.3"
  },
  "dependencies": {
    "@bogeychan/elysia-logger": "^0.1.1",
    "@elysiajs/cors": "^1.1.0",
    "@elysiajs/swagger": "1.0.5",
    "drizzle-orm": "^0.33.0",
    "elysia": "^1.1.6"
  }
}```

### What is the expected behavior?

200 : 'PATCH>>>>'

### What do you see instead?

501: ERROR: Unrecognized request method.

### Additional information

1. If you change it to put request without changing the code, the request goes.
2. If you send a PATCH request using another API test tool, the request is successful.
3. I sent the request after updating miniflare, pointing out that the patch request did not go from cloudFlare miniflare, but there was no response the same.
4. I've sent a request to another test router, but the same response.

### Have you try removing the `node_modules` and `bun.lockb` and try again yet?

yes
kravetsone commented 2 weeks ago

Why not just export elysia instance?