Skip to main content

System Variables

mockforme provides built-in variables that are accessible when defining a Conditional Response or within a Post Function.

Variables available for Conditional Responses

/*
* You can access request query parameters using mfm.query, e.g. mfm.query.q
* Example:
* if (mfm.query.q === "somevalue") return true;
*/
mfm.query

/*
* You can access request body (in POST or PUT) using mfm.body, e.g.:
* if (mfm.body.email === "test@mockforme.com") return true;
*/
mfm.body