{"id":22956957,"url":"https://github.com/codemancers/interceptor","last_synced_at":"2025-08-13T03:32:48.307Z","repository":{"id":8338909,"uuid":"57337986","full_name":"codemancers/interceptor","owner":"codemancers","description":"A browser extension to mock AJAX requests at the browser level","archived":false,"fork":false,"pushed_at":"2022-07-27T17:12:19.000Z","size":6184,"stargazers_count":210,"open_issues_count":28,"forks_count":26,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-01T15:56:32.310Z","etag":null,"topics":["chrome","firefox","interceptor","mock","mock-ajax-requests"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codemancers.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-28T22:33:06.000Z","updated_at":"2025-02-14T09:41:32.000Z","dependencies_parsed_at":"2022-08-07T03:00:08.621Z","dependency_job_id":null,"html_url":"https://github.com/codemancers/interceptor","commit_stats":null,"previous_names":["codemancers/interceptor","code-mancers/interceptor"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/codemancers/interceptor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemancers%2Finterceptor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemancers%2Finterceptor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemancers%2Finterceptor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemancers%2Finterceptor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codemancers","download_url":"https://codeload.github.com/codemancers/interceptor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemancers%2Finterceptor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270175826,"owners_count":24540093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chrome","firefox","interceptor","mock","mock-ajax-requests"],"created_at":"2024-12-14T17:14:04.600Z","updated_at":"2025-08-13T03:32:47.925Z","avatar_url":"https://github.com/codemancers.png","language":"TypeScript","readme":"# Interceptor \n\n[![Build Status](https://travis-ci.org/code-mancers/interceptor.svg?branch=master)](https://travis-ci.org/code-mancers/interceptor)\n[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/code-mancers/interceptor/blob/master/LICENSE)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n\n\nA browser extension that mocks AJAX request at the browser level so you\ncan run front ends without really starting a backend server.\n\nFirefox : [![Mozilla Add-on](https://img.shields.io/amo/rating/xhr-interceptor.svg)](https://addons.mozilla.org/en-US/firefox/addon/xhr-interceptor/)\n\nChrome : [![Chrome Web Store](https://img.shields.io/chrome-web-store/rating/enenfaicdcfgcnjmiigcjbmlbaoapnen.svg)](https://chrome.google.com/webstore/detail/interceptor/enenfaicdcfgcnjmiigcjbmlbaoapnen)\n\n## Development\n\nIn Chrome\n\n```\n$ yarn install\n$ yarn run watch\n# Install \"./dist\" directory as \"unpacked chrome extension\" (google it!)\n```\n\nIn Firefox\n\n```\n$ yarn install\n$ yarn run watch\n$ yarn global add web-ext \n$ web-ext run -s dist -f \"/usr/bin/firefox\"\n```\n\n## Release\n\n```\n$ yarn run build\n$ AMO_API_KEY=\u003camo api key\u003e AMO_API_SECRET=\u003camo api secret\u003e NEW_VERSION=0.3.2 yarn run release\n```\n\n\n## How to use\n\n### Listening to requests made by the browser\n\nOnce you open the extension popup, it shows a UI as seen below. By default, `Intercept Mode` is `ON`.\n\n\u003cimg src=\"images/interceptor_ui.png\" alt=\"Interceptor extension default popup\"\u003e\n\nOnce you start listening, it shows the count of total AJAX requests in a small badge and list of incoming `XHR` requests\nin the popup like this:\n\n\u003cimg src=\"images/interceptor_ui_xhr_list.png\" alt=\"Interceptor extension popup showing a list of AJAX requests\"\u003e\n\nRequest headers for listened requests are listed below the response form as shown in the screenshot.\n\n\u003cimg src=\"images/interceptor_textfields.png\" alt=\"A screenshot of Listened requests with request headers\"\u003e\n\n#### Response data returned by backend server\n\nMany a times, before defining you mock response text, you would want to look at the response data returned by the server when the request is made. On clicking `Fetch Response` button, the `textarea` gets filled with the response data from the real server as shown below. However, You can completely skip this step and move on to typing out mock response text.\n\n\u003cimg src=\"images/interceptor_showresponse.png\" alt=\"Fetching data from backend server\"\u003e\n\n#### Specifying mock response data\n\nYou can click the small arrow beside the URL, which shows a form in which you can specify a response to mock, when the same request is encountered next. You also need to specify the [Content-Type header][content-type] field and [status code][status-code] for the mock response through the dropdown available as shown below.\n\n\u003cimg src=\"images/interceptor_modifyresponse.png\" alt=\"Specify mock responses using Interceptor as shown\"\u003e\n\nOnce the above fields are filled and checkbox is checked, click the `INTERCEPT` button. If the interception is successfull, it shows a success message as below:\n\n\u003cimg src=\"images/intercept_success.png\" alt=\"Success message shown by Interceptor upon sucessful interception\"\u003e\n\nYou can intercept/mock multiple calls by checking as many checkboxes as you want\n\n\u003cimg src=\"images/intercept_multiple_xhr.png\" alt=\"Success message shown by Interceptor upon sucessful interception\"\u003e\n\nHenceforth the same AJAX request is made by the browser, the browser is given a fake/mock response instead of the real one.\n\nYou can also stop listening for `AJAX calls` by clicking the `STOP LISTENING` button. Requests made henceforth won't be listed on UI.\n\nThe toggle switch is used to disable `INTERCEPTOR`. If the toggle is switched to `OFF` state, it displays a message saying `Interception Disabled` as below.\n\n\u003cimg src=\"images/interceptor_disabled.png\" alt=\"Message shown by Interceptor on disabling\"\u003e\n\nIn the `disabled` state, the extension won't mock any previously intercepted calls. Instead all `XHR's` are routed to the server.\nThe extension's icon beside the url address bar turns red for that particular tab as in screenshot above.\n\n\nTo mock the calls again, just toggle the switch to `ON` state, check the requests that are to be mocked and click `INTERCEPT` button.\n\nThis [blogpost](https://crypt.codemancers.com/posts/2018-04-24-intro-to-interceptor/) makes things much more clear.\n\n## TODO\n\n* ~~A user should be able to click on the extension button and see a popup with a list of all AJAX requests.~~\n* A user should be able to \"watch\" ajax requests using a URL pattern.\n* If watched requests are in pre-flight, block everything and ask the user how to handle it.\n* ~~The user may choose to let the request pass through or fill in mock response using a form.~~\n* Persist settings for each URL in localStorage.\n* ~~Mocked requests should hit a sinon fakeServer.~~\n* ~~User should be able to disable/enable mocking for a page without clearing persisted settings for the URL.~~\n\n## Attribution\n\nIcons for this projects are used from [Font Awesome](https://fontawesome.com)\n\n * [Play Circle](https://fontawesome.com/icons/play-circle?style=solid) and [Stop Circle](https://fontawesome.com/icons/stop-circle?style=solid) icons are used from [Font Awesome](https://fontawesome.com/license)\n\n\n## License\n\nMIT\n\n[content-type]: https://www.w3.org/Protocols/rfc1341/4_Content-Type.html\n[status-code]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemancers%2Finterceptor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodemancers%2Finterceptor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemancers%2Finterceptor/lists"}