Socket
Socket
Sign inDemoInstall

fetch-mock

Package Overview
Dependencies
2
Maintainers
1
Versions
213
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.2 to 1.1.3

2

package.json
{
"name": "fetch-mock",
"version": "1.1.2",
"version": "1.1.3",
"description": "Mock http requests made using fetch (or isomorphic-fetch)",

@@ -5,0 +5,0 @@ "main": "server.js",

@@ -22,3 +22,3 @@ # fetch-mock [![Build Status](https://travis-ci.org/wheresrhys/fetch-mock.svg?branch=master)](https://travis-ci.org/wheresrhys/fetch-mock) [![Coverage Status](https://coveralls.io/repos/wheresrhys/fetch-mock/badge.svg)](https://coveralls.io/r/wheresrhys/fetch-mock)

* `Function(url, opts)`: A function that is passed the url and opts `fetch` is called with and that returns a Boolean
* `response`: Configures the response object returned by the mock. Can have one of the following values
* `response`: Configures the response object returned by the mock. Can take any of the following values
* `string`: creates a 200 response with the string as the response body

@@ -30,3 +30,4 @@ * `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

* `throws`: If this property is present then a `Promise` rejected with the value of `throws` is returned
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
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
* `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

@@ -33,0 +34,0 @@ * `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.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc