Configurable catchall on xrpc-server (#2384)
* allow configurable catchall on xrpc-server * changeset
This commit is contained in:
parent
115df69574
commit
cd4fcc709f
5
.changeset/lovely-parrots-talk.md
Normal file
5
.changeset/lovely-parrots-talk.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'@atproto/xrpc-server': patch
|
||||
---
|
||||
|
||||
Add configurable catchall
|
@ -72,7 +72,10 @@ export class Server {
|
||||
this.addLexicons(lexicons)
|
||||
}
|
||||
this.router.use(this.routes)
|
||||
this.router.use('/xrpc/:methodId', this.catchall.bind(this))
|
||||
this.router.use(
|
||||
'/xrpc/:methodId',
|
||||
opts?.catchall ?? this.catchall.bind(this),
|
||||
)
|
||||
this.router.use(errorMiddleware)
|
||||
this.router.once('mount', (app: Application) => {
|
||||
this.enableStreamingOnListen(app)
|
||||
|
@ -8,8 +8,15 @@ import {
|
||||
ResponseTypeNames,
|
||||
} from '@atproto/xrpc'
|
||||
|
||||
export type CatchallHandler = (
|
||||
req: express.Request,
|
||||
_res: express.Response,
|
||||
next: express.NextFunction,
|
||||
) => unknown
|
||||
|
||||
export type Options = {
|
||||
validateResponse?: boolean
|
||||
catchall?: CatchallHandler
|
||||
payload?: {
|
||||
jsonLimit?: number
|
||||
blobLimit?: number
|
||||
|
Loading…
x
Reference in New Issue
Block a user