parent
6036bd2c3b
commit
f8e0cc44f9
3 changed files with 40 additions and 1 deletions
|
@ -41,10 +41,18 @@ class Mock implements Comparable<Mock> {
|
|||
throw new RuntimeException("Mock name must be given")
|
||||
}
|
||||
this.name = name
|
||||
this.path = path
|
||||
this.path = stripLeadingSlash(path)
|
||||
this.port = port
|
||||
}
|
||||
|
||||
private static String stripLeadingSlash(String path) {
|
||||
if (path?.startsWith('/')) {
|
||||
return path - '/'
|
||||
} else {
|
||||
return path
|
||||
}
|
||||
}
|
||||
|
||||
boolean match(Method method, MockRequest request) {
|
||||
return this.method == method && predicate(request)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue