mirror of
https://gh-proxy.org/https://github.com/klinsmaya/gateway.git
synced 2026-11-10 10:07:26 +08:00
16 lines
361 B
TypeScript
16 lines
361 B
TypeScript
import { PluginContext } from './types';
|
|
|
|
export const getText = (context: PluginContext): string => {
|
|
let text = '';
|
|
|
|
switch (context.hookType) {
|
|
case 'beforeRequestHook':
|
|
return context.request?.text;
|
|
case 'afterResponseHook':
|
|
return context.response?.text;
|
|
default:
|
|
throw new Error('Invalid hook type');
|
|
break;
|
|
}
|
|
};
|