22 lines
739 B
Plaintext
22 lines
739 B
Plaintext
const NON_STATIC_METHODS = [
|
|
"OPTIONS",
|
|
"POST",
|
|
"PUT",
|
|
"DELETE",
|
|
"PATCH"
|
|
];
|
|
/**
|
|
* Gets all the method names for handlers that are not considered static.
|
|
*
|
|
* @param handlers the handlers from the userland module
|
|
* @returns the method names that are not considered static or false if all
|
|
* methods are static
|
|
*/ export function getNonStaticMethods(handlers) {
|
|
// We can currently only statically optimize if only GET/HEAD are used as
|
|
// prerender can't be used conditionally based on the method currently.
|
|
const methods = NON_STATIC_METHODS.filter((method)=>handlers[method]);
|
|
if (methods.length === 0) return false;
|
|
return methods;
|
|
}
|
|
|
|
//# sourceMappingURL=get-non-static-methods.js.map |