mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-18 07:23:51 +01:00
Move plugin stuff around
This commit is contained in:
13
plugins/filter-jsonpath/src/index.js
Normal file
13
plugins/filter-jsonpath/src/index.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import jp from 'jsonpath';
|
||||
|
||||
export function pluginHookResponseFilter({ text, filter }) {
|
||||
let parsed;
|
||||
try {
|
||||
parsed = JSON.parse(text);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
const filtered = jp.query(parsed, filter);
|
||||
|
||||
return { filtered };
|
||||
}
|
||||
Reference in New Issue
Block a user