Skip to content

Commit bebed32

Browse files
committed
Fix type definition.
1 parent c9528bd commit bebed32

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

packages/net-stubbing/lib/external-types.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
/**
22
* HTTP request/response types.
33
*/
4+
type HTTPRequestMethod = 'get' | 'head' | 'post' | 'put' | 'delete' | 'connect' | 'options' | 'trace' | 'patch' |
5+
'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'
6+
type WebDAVMethod = 'copy' | 'lock' | 'mkcol' | 'move' | 'propfind' | 'proppatch' | 'unlock' |
7+
'COPY' | 'LOCK' | 'MKCOL' | 'MOVE' | 'PROPFIND' | 'PROPPATCH' | 'UNLOCK'
8+
9+
type Method = HTTPRequestMethod | WebDAVMethod
10+
411
export namespace CyHttpMessages {
512
interface BaseMessage {
613
body?: any
714
headers: { [key: string]: string }
815
url: string
9-
method?: string
16+
method?: Method
1017
httpVersion?: string
1118
}
1219

@@ -176,8 +183,8 @@ export interface RouteMatcherOptionsGeneric<S> extends RouteMatcherCompatOptions
176183
*/
177184
https?: boolean
178185
/**
179-
* Match against the request's HTTP method.
180-
* @default 'GET'
186+
* Match against the request's HTTP or WebDAV method.
187+
* @default '*'
181188
*/
182189
method?: S
183190
/**
@@ -289,7 +296,7 @@ declare global {
289296
* @example
290297
* cy.route2('GET', 'http://foo.com/fruits', ['apple', 'banana', 'cherry'])
291298
*/
292-
route2(method: string, url: RouteMatcher, response?: RouteHandler): Chainable<null>
299+
route2(method: Method, url: RouteMatcher, response?: RouteHandler): Chainable<null>
293300
}
294301
}
295302
}

0 commit comments

Comments
 (0)