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
How should the user describe a request handler where one logical branch returns a consistent response while the other a one-time response?
// From the V1:rest.get('/resource',(req,res,ctx)=>{if(a){returnres(ctx.text('One'))}returnres.once(ctx.text('Foo'))})
If the a condition won't be met, the res.once will be returned, terminating this handler. But if the condition is met, a consistent text response will be returned, preserving this handler.
V2 has no alternative to describe this behavior within a single handler since the { once: true } option applies to the entire request handler. You'd have to split this one into two, which is suboptimal.
The text was updated successfully, but these errors were encountered:
Scope
Adds a new behavior
Compatibility
Feature description
How should the user describe a request handler where one logical branch returns a consistent response while the other a one-time response?
If the
a
condition won't be met, theres.once
will be returned, terminating this handler. But if the condition is met, a consistent text response will be returned, preserving this handler.V2 has no alternative to describe this behavior within a single handler since the
{ once: true }
option applies to the entire request handler. You'd have to split this one into two, which is suboptimal.The text was updated successfully, but these errors were encountered: