You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mean you don't need manually check prefix, oRPC do that for you
Before:
```ts
export async function fetch(request: Request): Promise<Response> {
const url = new URL(request.url)
if (url.pathname.startsWith('/rpc')) {
const { response } = await handler.handle(request, {
prefix: '/rpc',
context: {} // Provide initial context if needed
})
if (response)
return response
}
return new Response('Not found', { status: 404 })
}
```
After:
```ts
export async function fetch(request: Request): Promise<Response> {
const { matched, response } = await handler.handle(request, {
prefix: '/rpc',
context: {} // Provide initial context if needed
})
if (matched) {
return response
}
return new Response('Not found', { status: 404 })
}
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Refactor**
- Streamlined request processing across various integrations to ensure
consistent API and RPC responses, including reliable handling of
unmatched requests.
- **Tests**
- Added coverage to verify proper behavior when an invalid request
prefix is provided.
- **Chores**
- Updated URL formatting to standardize trailing slash removal and
removed an unused utility for cleaner maintenance.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
0 commit comments