mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
fix(yar): add missing session id property (#27761)
This commit is contained in:
committed by
Sheetal Nandi
parent
794cbd6ada
commit
29d45249cd
Vendored
+5
@@ -105,12 +105,17 @@ declare namespace yar {
|
||||
* an optional function to create custom session IDs.
|
||||
* Must retun a string and have the signature function (request) where:
|
||||
* request - (optional) is the original request received from the client.
|
||||
* Defaults to uuidv4
|
||||
*/
|
||||
customSessionIDGenerator?(req: Request): string;
|
||||
};
|
||||
}
|
||||
|
||||
interface Yar {
|
||||
/**
|
||||
* Session id, see `customSessionIDGenerator`.
|
||||
*/
|
||||
readonly id: string;
|
||||
/**
|
||||
* clears the session and assigns a new session id.
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,10 @@ async function boot() {
|
||||
method: 'get',
|
||||
handler(request: Request) {
|
||||
const example = request.yar.get('example');
|
||||
return example.key;
|
||||
return {
|
||||
id: request.yar.id,
|
||||
key: example.key,
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user