{"id":16318977,"url":"https://github.com/sqlwwx/axios-mock-router","last_synced_at":"2025-10-20T00:48:42.544Z","repository":{"id":57188602,"uuid":"156965913","full_name":"sqlwwx/axios-mock-router","owner":"sqlwwx","description":null,"archived":false,"fork":false,"pushed_at":"2020-05-31T00:07:12.000Z","size":396,"stargazers_count":0,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-21T00:20:25.719Z","etag":null,"topics":["axios","koa-router","mocking"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sqlwwx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-10T09:20:27.000Z","updated_at":"2020-07-30T13:00:37.000Z","dependencies_parsed_at":"2022-08-28T13:00:36.904Z","dependency_job_id":null,"html_url":"https://github.com/sqlwwx/axios-mock-router","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sqlwwx/axios-mock-router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlwwx%2Faxios-mock-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlwwx%2Faxios-mock-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlwwx%2Faxios-mock-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlwwx%2Faxios-mock-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sqlwwx","download_url":"https://codeload.github.com/sqlwwx/axios-mock-router/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlwwx%2Faxios-mock-router/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279960376,"owners_count":26251359,"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-10-19T02:00:07.647Z","response_time":64,"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":["axios","koa-router","mocking"],"created_at":"2024-10-10T22:25:18.868Z","updated_at":"2025-10-20T00:48:42.517Z","avatar_url":"https://github.com/sqlwwx.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# axios-mock-router\n\nmock axios like koa-router\n\n[![Build Status](https://travis-ci.org/sqlwwx/axios-mock-router.svg?branch=master)](https://travis-ci.org/sqlwwx/axios-mock-router)\n[![Coverage Status](https://coveralls.io/repos/github/sqlwwx/axios-mock-router/badge.svg?branch=master)](https://coveralls.io/github/sqlwwx/axios-mock-router?branch=master)\n[![Greenkeeper badge](https://badges.greenkeeper.io/sqlwwx/axios-mock-router.svg)](https://greenkeeper.io/)\n![npm](https://img.shields.io/npm/dt/axios-mock-router.svg)\n[![codebeat badge](https://codebeat.co/badges/8cecad6a-6ff0-412e-8397-ee6227784697)](https://codebeat.co/projects/github-com-sqlwwx-axios-mock-router-master)\n\n\n## example\n\n```\nimport AxiosMockRouter from 'axios-mock-router'\nimport axios from 'axios'\n\nconst router = new AxiosMockRouter(axios);\n\nrouter\n  .get('https://github.com/', (ctx, next) =\u003e {\n    ctx.body = 'github';\n  })\n  .get('/', (ctx, next) =\u003e {\n    ctx.body = 'home';\n  })\n  .get('/users', (ctx, next) =\u003e {\n    ctx.body = `get users ${JSON.stringify(ctx.query)}`;\n  })\n  .post('/users', (ctx, next) =\u003e {\n    ctx.body = `post users ${ctx.request.body}`;\n  })\n  .get('/users/:id', (ctx, next) =\u003e {\n    ctx.body = `get user [${ctx.params.id}] ${JSON.stringify(ctx.query)}`;\n  })\n  .put('/users/:id', (ctx, next) =\u003e {\n    ctx.body = `put user [${ctx.params.id}] ${ctx.request.body}`;\n  })\n  .del('/users', (ctx, next) =\u003e {\n    ctx.body = `del users ${JSON.stringify(ctx.query)}`;\n  })\n  .del('/users/:id', (ctx, next) =\u003e {\n    ctx.body = `del user [${ctx.params.id}] ${JSON.stringify(ctx.query)}`;\n  });\n\naxios.get('https://github.com/')\n  .then(res =\u003e console.log(res.data === 'github'))\naxios.get('https://github.com/sqlwwx')\n  .then(res =\u003e console.log(res.data !== 'github'))\naxios.get('/')\n  .then(res =\u003e console.log(res.data === 'home'))\naxios.get('/users')\n  .then(res =\u003e console.log(res.data === 'get users {}'))\naxios.get('/users?limit=1')\n  .then(res =\u003e console.log(res.data === 'get users {\"limit\":\"1\"}'))\naxios.post('/users', { name: 'wwx' })\n  .then(res =\u003e console.log(res.data === `post users {\"name\":\"wwx\"}`))\naxios.put('/users/1', { name: 'wwx' })\n  .then(res =\u003e console.log(res.data === 'put user [1] {\"name\":\"wwx\"}'))\naxios.get('/users/1?includeStart=true')\n  .then(res =\u003e console.log(res.data === 'get user [1] {\"includeStart\":\"true\"}'))\naxios.delete('/users?idList=[1,2]')\n  .then(res =\u003e console.log(res.data === 'del users {\"idList\":\"[1,2]\"}'))\naxios.delete('/users/1')\n  .then(res =\u003e console.log(res.data === 'del user [1] {}'))\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqlwwx%2Faxios-mock-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsqlwwx%2Faxios-mock-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqlwwx%2Faxios-mock-router/lists"}