Skip to content

Commit

Permalink
FormidableLabs#64 Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwsperber committed Mar 29, 2020
1 parent deb47f6 commit 17d6617
Show file tree
Hide file tree
Showing 21 changed files with 601 additions and 112 deletions.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* ["http-serializer"](modules/_http_serializer_.md)
* ["index"](modules/_index_.md)
* ["interceptor"](modules/_interceptor_.md)
* ["mock-response"](modules/_mock_response_.md)
* ["recording"](modules/_recording_.md)
* ["yesno"](modules/_yesno_.md)

Expand Down
98 changes: 98 additions & 0 deletions docs/classes/_context_.context.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,33 @@ Store the current execution context for YesNo by tracking requests & mocks.

### Properties

* [comparatorFn](_context_.context.md#comparatorfn)
* [inFlightRequests](_context_.context.md#inflightrequests)
* [interceptedRequestsCompleted](_context_.context.md#interceptedrequestscompleted)
* [loadedMocks](_context_.context.md#loadedmocks)
* [mode](_context_.context.md#mode)
* [responsesForMatchingRequests](_context_.context.md#responsesformatchingrequests)

### Methods

* [addResponseForMatchingRequests](_context_.context.md#addresponseformatchingrequests)
* [clear](_context_.context.md#clear)
* [getMatchingIntercepted](_context_.context.md#getmatchingintercepted)
* [getMatchingMocks](_context_.context.md#getmatchingmocks)
* [getResponseDefinedMatching](_context_.context.md#getresponsedefinedmatching)
* [hasResponsesDefinedForMatchers](_context_.context.md#hasresponsesdefinedformatchers)

---

## Properties

<a id="comparatorfn"></a>

### comparatorFn

**● comparatorFn**: *[ComparatorFn](../modules/_filtering_comparator_.md#comparatorfn)* = comparatorByUrl

___
<a id="inflightrequests"></a>

### inFlightRequests
Expand All @@ -50,10 +65,39 @@ ___

Serialized records loaded from disk.

___
<a id="mode"></a>

### mode

**● mode**: *`Mode`* = Mode.Spy

___
<a id="responsesformatchingrequests"></a>

### responsesForMatchingRequests

**● responsesForMatchingRequests**: *[IResponseForMatchingRequest](../interfaces/_context_.iresponseformatchingrequest.md)[]* = []

___

## Methods

<a id="addresponseformatchingrequests"></a>

### addResponseForMatchingRequests

**addResponseForMatchingRequests**(matchingResponse: *[IResponseForMatchingRequest](../interfaces/_context_.iresponseformatchingrequest.md)*): `void`

**Parameters:**

| Name | Type |
| ------ | ------ |
| matchingResponse | [IResponseForMatchingRequest](../interfaces/_context_.iresponseformatchingrequest.md) |

**Returns:** `void`

___
<a id="clear"></a>

### clear
Expand All @@ -63,4 +107,58 @@ ___
**Returns:** `void`

___
<a id="getmatchingintercepted"></a>

### getMatchingIntercepted

**getMatchingIntercepted**(matcher: *[Matcher](../modules/_filtering_matcher_.md#matcher)*): [ISerializedHttp](../interfaces/_http_serializer_.iserializedhttp.md)[]

**Parameters:**

| Name | Type |
| ------ | ------ |
| matcher | [Matcher](../modules/_filtering_matcher_.md#matcher) |

**Returns:** [ISerializedHttp](../interfaces/_http_serializer_.iserializedhttp.md)[]

___
<a id="getmatchingmocks"></a>

### getMatchingMocks

**getMatchingMocks**(matcher: *[Matcher](../modules/_filtering_matcher_.md#matcher)*): [ISerializedHttp](../interfaces/_http_serializer_.iserializedhttp.md)[]

**Parameters:**

| Name | Type |
| ------ | ------ |
| matcher | [Matcher](../modules/_filtering_matcher_.md#matcher) |

**Returns:** [ISerializedHttp](../interfaces/_http_serializer_.iserializedhttp.md)[]

___
<a id="getresponsedefinedmatching"></a>

### getResponseDefinedMatching

**getResponseDefinedMatching**(request: *[ISerializedRequest](../interfaces/_http_serializer_.iserializedrequest.md)*): [ISerializedResponse](../interfaces/_http_serializer_.iserializedresponse.md) &#124; `undefined`

**Parameters:**

| Name | Type |
| ------ | ------ |
| request | [ISerializedRequest](../interfaces/_http_serializer_.iserializedrequest.md) |

**Returns:** [ISerializedResponse](../interfaces/_http_serializer_.iserializedresponse.md) &#124; `undefined`

___
<a id="hasresponsesdefinedformatchers"></a>

### hasResponsesDefinedForMatchers

**hasResponsesDefinedForMatchers**(): `boolean`

**Returns:** `boolean`

___

22 changes: 22 additions & 0 deletions docs/classes/_filtering_collection_.filteredhttpcollection.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Can filter both intercepted HTTP requests and loaded mocks.
* [only](_filtering_collection_.filteredhttpcollection.md#only)
* [redact](_filtering_collection_.filteredhttpcollection.md#redact)
* [request](_filtering_collection_.filteredhttpcollection.md#request)
* [respond](_filtering_collection_.filteredhttpcollection.md#respond)
* [response](_filtering_collection_.filteredhttpcollection.md#response)

---
Expand Down Expand Up @@ -142,6 +143,27 @@ Throws an exception if multiple requests were matched.

**Returns:** [ISerializedRequest](../interfaces/_http_serializer_.iserializedrequest.md)

___
<a id="respond"></a>

### respond

**respond**(response: *[PartialResponseForRequest](../modules/_filtering_collection_.md#partialresponseforrequest)*): `void`

Provide a mock response for all matching requests.

Use callback to dynamically generate response per request.

Matching responses defined here take _precedence_ over mocks loaded normally.

**Parameters:**

| Name | Type | Description |
| ------ | ------ | ------ |
| response | [PartialResponseForRequest](../modules/_filtering_collection_.md#partialresponseforrequest) | Serialized HTTP response or callback |

**Returns:** `void`

___
<a id="response"></a>

Expand Down
56 changes: 0 additions & 56 deletions docs/classes/_interceptor_.interceptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,13 @@ Uses MITM library to spy on HTTP requests made in current NodeJS process.

## Index

### Constructors

* [constructor](_interceptor_.interceptor.md#constructor)

### Properties

* [clientRequests](_interceptor_.interceptor.md#clientrequests)
* [comparatorFn](_interceptor_.interceptor.md#comparatorfn)
* [ignorePorts](_interceptor_.interceptor.md#ignoreports)
* [mitm](_interceptor_.interceptor.md#mitm)
* [origOnSocket](_interceptor_.interceptor.md#origonsocket)
* [requestNumber](_interceptor_.interceptor.md#requestnumber)
* [shouldProxy](_interceptor_.interceptor.md#shouldproxy)
* [defaultMaxListeners](_interceptor_.interceptor.md#defaultmaxlisteners)

### Methods
Expand All @@ -51,7 +45,6 @@ Uses MITM library to spy on HTTP requests made in current NodeJS process.
* [once](_interceptor_.interceptor.md#once)
* [prependListener](_interceptor_.interceptor.md#prependlistener)
* [prependOnceListener](_interceptor_.interceptor.md#prependoncelistener)
* [proxy](_interceptor_.interceptor.md#proxy)
* [rawListeners](_interceptor_.interceptor.md#rawlisteners)
* [removeAllListeners](_interceptor_.interceptor.md#removealllisteners)
* [removeListener](_interceptor_.interceptor.md#removelistener)
Expand All @@ -61,24 +54,6 @@ Uses MITM library to spy on HTTP requests made in current NodeJS process.

---

## Constructors

<a id="constructor"></a>

### constructor

**new Interceptor**(options?: * `undefined` &#124; `object`*): [Interceptor](_interceptor_.interceptor.md)

**Parameters:**

| Name | Type |
| ------ | ------ |
| `Optional` options | `undefined` &#124; `object`|

**Returns:** [Interceptor](_interceptor_.interceptor.md)

___

## Properties

<a id="clientrequests"></a>
Expand All @@ -87,13 +62,6 @@ ___

**● clientRequests**: *[ClientRequestTracker](../interfaces/_interceptor_.clientrequesttracker.md)*

___
<a id="comparatorfn"></a>

### `<Private>``<Optional>` comparatorFn

**● comparatorFn**: *[ComparatorFn](../modules/_filtering_comparator_.md#comparatorfn)*

___
<a id="ignoreports"></a>

Expand Down Expand Up @@ -123,13 +91,6 @@ ___

**● requestNumber**: *`number`* = 0

___
<a id="shouldproxy"></a>

### `<Private>` shouldProxy

**● shouldProxy**: *`boolean`* = true

___
<a id="defaultmaxlisteners"></a>

Expand Down Expand Up @@ -384,23 +345,6 @@ ___

**Returns:** `this`

___
<a id="proxy"></a>

### proxy

**proxy**(shouldProxy: *`boolean`*): `void`

Enable/disable proxying. If proxying, requests are not sent to their original destination.

**Parameters:**

| Name | Type | Description |
| ------ | ------ | ------ |
| shouldProxy | `boolean` | Whether or not to proxy |

**Returns:** `void`

___
<a id="rawlisteners"></a>

Expand Down
Loading

0 comments on commit 17d6617

Please sign in to comment.