Skip to main content

How to Mock HTTP Requests in the Android Yandex Browser

Some time back, we've received feedback from a user stating that they could use our browser extension in mobile using the Yandex browser and gave some feedback about usability. We don't develop for mobile, but when we found out it was possible, we improved our import/export flow to allow users to quickly load in a JSON file with many configurations and operate with the app while mocking requests with tweak. Let's look at how to achieve it.

Here's a small demonstration.

using tweak to mock request in an android browser

Configure the extension in a desktop browser#

First, you'll want to open the extension as you usually do in a desktop browser and set up the extension. We'll set up the two requests you see in the extension to mock data in our example application.

tweak example configuration

Export the configuration and share it#

Now that we've set up the extension, we'll use the export functionality to get a JSON file containing the current configurations, including all the mocks, to import it into our mobile browser. Now we need to find a way to send the file to the mobile device (we can use some cloud storage such as google docs, dropbox, or similar to share this file).

export rules in tweak

Install the extension in the Yandex Android Browser#

The Yandex browser allows you to install extensions from the Chrome store. That's what we'll do. Let's go over the tweak Chrome storage page and hit the install button. Notice in the below screenshot, the extension can be seen in the inferior part of the Yandex browser.

Import the configuration and activate the extension#

Now we import our file in the Yandex browser. We open the extension and hit the import link in the empty state screen. First we import it.

import configuration in the yandex browser

Once the configuration is successful, you'll be able to see the success notification in the extension icon, and you'll find your tweak configurations inside the extension.

import badge configuration visible in the more options menu

notification of import successful in the extension

See requests mocked in the app#

Now we activate the extension, observe the extension taking effect on the page while interacting with the web app, and apply the mocks for intercepted HTTP requests.

using tweak to mock request in an android browser


We did a short tutorial on how to use our extension in the Yandex Android browser. We don't hope this to become a many-use case; anyways, we tough it would be relevant to document it in our blog.



If you liked this article, consider sharing (tweeting) it to your followers.



Did you like this article?