SharedPreferencesMockRuleStorage

The default MockRuleStorage backed by SharedPreferences.

Rules are stored as a JSON array under a single key so they survive app restarts and can be set up before the browser console is opened.

Constructors

Link copied to clipboard
constructor(prefs: SharedPreferences)

Functions

Link copied to clipboard
open override fun load(): List<MockRule>

Loads the persisted rules; corrupt data yields an empty list, and a rule the interceptor could not turn into a response is dropped.

Link copied to clipboard
open override fun save(rules: List<MockRule>)

Persists rules synchronously (commit, not apply — see code comment).