Comparing version 3.11.0 to 3.12.0
@@ -296,2 +296,7 @@ 'use strict'; | ||
} | ||
function matchUrl(url) { | ||
if (url === mockUrl) return true; | ||
if (mockUrl instanceof RegExp && url.match(mockUrl)) return true; | ||
return false; | ||
} | ||
@@ -303,3 +308,3 @@ // support generator rather than callback and promise | ||
opt.headers = opt.headers || {}; | ||
if (url === mockUrl && matchMethod(opt.method)) { | ||
if (matchUrl(url) && matchMethod(opt.method)) { | ||
const response = { | ||
@@ -306,0 +311,0 @@ status: mockResult.status, |
3.12.0 / 2017-09-12 | ||
================== | ||
**others** | ||
* [[`25a0e28`](http://github.com/eggjs/egg-mock/commit/25a0e28e85209ec08a593b38cd434ed389ef8887)] - feat(mockHttpclient): use Regular Expression for matching url (#57) (Haoliang Gao <<sakura9515@gmail.com>>) | ||
3.11.0 / 2017-09-11 | ||
@@ -3,0 +9,0 @@ ================== |
{ | ||
"name": "egg-mock", | ||
"version": "3.11.0", | ||
"version": "3.12.0", | ||
"eggPlugin": { | ||
@@ -5,0 +5,0 @@ "name": "egg-mock" |
@@ -375,2 +375,12 @@ # egg-mock | ||
You can also use Regular Expression for matching url. | ||
```js | ||
app.mockHttpclient(/\/users\/[a-z]$/i, { | ||
data: { | ||
name: 'egg', | ||
}, | ||
}); | ||
``` | ||
## Bootstrap | ||
@@ -377,0 +387,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52993
1324
413