You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-2
Original file line number
Diff line number
Diff line change
@@ -19,14 +19,15 @@ Replaces `fetch()` with a sinon stub which, in addition to the default sinon beh
19
19
* `string`: Either an exact url to match e.g. 'http://www.site.com/page.html' or, if the string begins with a `^`, the string following the `^` must begin the url e.g. '^http://www.site.com' would match 'http://www.site.com' or 'http://www.site.com/page.html'
20
20
* `RegExp`: A regular expression to test the url against
21
21
* `Function(url, opts)`: A function that is passed the url and opts `fetch` is called with and that returns a Boolean
22
-
* `response`: Configures the response object returned by the mock. Can have one of the following values
22
+
* `response`: Configures the response object returned by the mock. Can take any of the following values
23
23
* `string`: creates a 200 response with the string as the response body
24
24
* `object`: If the object contains any of the properties body, status, headers, throws; then these properties - all of them optional - are used to construct a response as follows
25
25
* `body`: Retunred in the response body
26
26
* `status`: Returned in the response status
27
27
* `headers`: Returned in the response headers. They should be defined as an object literal (property names case-insensitive) which will be converted to a `Headers` instance
28
28
* `throws`: If this property is present then a `Promise` rejected with the value of `throws` is returned
29
-
As long as the object does not contain any of the above properties it is converted into a json string and this is returned as the body of a 200 response
29
+
30
+
As long as the object does not contain any of the above properties it is converted into a json string and this is returned as the body of a 200 response
30
31
* `Function(url, opts)`: A function that is passed the url and opts `fetch()` is called with and that returns any of the responses listed above
31
32
*`responses`: When `registerRoute()` has already been used to register some routes then `responses` can be used to override the default response. Its value should be an object mapping route names to responses, which should be similar to those listed immediately above e.g.
0 commit comments