diff --git a/kassette.configurationspec.harmimetypesparsejson.md b/kassette.configurationspec.harmimetypesparsejson.md new file mode 100644 index 00000000..7187c49c --- /dev/null +++ b/kassette.configurationspec.harmimetypesparsejson.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@amadeus-it-group/kassette](./kassette.md) > [ConfigurationSpec](./kassette.configurationspec.md) > [harMimeTypesParseJson](./kassette.configurationspec.harmimetypesparsejson.md) + +## ConfigurationSpec.harMimeTypesParseJson property + +Used only when the [mocks format](./kassette.imock.mocksformat.md) is 'har', specifies a list of mime types that will attempt to parse the request/response body as JSON. If the list includes an empty string: '' and there is no mimeType set in the request, it will attempt to parse the body as JSON. This will only be applicable to request bodies if [saveInputRequestBody](./kassette.imock.saveinputrequestbody.md) is set to true Default value will be \[\] and will only be overridden by [setHarMimeTypesParseJson](./kassette.imock.setharmimetypesparsejson.md) + +**Signature:** + +```typescript +readonly harMimeTypesParseJson?: string[]; +``` diff --git a/kassette.configurationspec.md b/kassette.configurationspec.md index c6e04c3b..3aa9f1fd 100644 --- a/kassette.configurationspec.md +++ b/kassette.configurationspec.md @@ -18,6 +18,7 @@ export interface ConfigurationSpec extends CLIConfigurationSpec | Property | Modifiers | Type | Description | | --- | --- | --- | --- | | [console?](./kassette.configurationspec.console.md) | readonly | [ConsoleSpec](./kassette.consolespec.md) | _(Optional)_ Custom implementation of the [ConsoleSpec](./kassette.consolespec.md) interface, with methods [log](./kassette.consolespec.log.md) and [error](./kassette.consolespec.error.md), each receiving one single argument of any type. Useful to capture the logs of the application. | +| [harMimeTypesParseJson?](./kassette.configurationspec.harmimetypesparsejson.md) | readonly | string\[\] | _(Optional)_ Used only when the [mocks format](./kassette.imock.mocksformat.md) is 'har', specifies a list of mime types that will attempt to parse the request/response body as JSON. If the list includes an empty string: '' and there is no mimeType set in the request, it will attempt to parse the body as JSON. This will only be applicable to request bodies if [saveInputRequestBody](./kassette.imock.saveinputrequestbody.md) is set to true Default value will be \[\] and will only be overridden by [setHarMimeTypesParseJson](./kassette.imock.setharmimetypesparsejson.md) | | [mocksHarKeyManager?](./kassette.configurationspec.mocksharkeymanager.md) | readonly | [HarKeyManager](./kassette.harkeymanager.md) | _(Optional)_ Function called to get or set the key of a mock in a har file, as explained in [HarKeyManager](./kassette.harkeymanager.md). | ## Methods diff --git a/kassette.harformatcontent.json.md b/kassette.harformatcontent.json.md new file mode 100644 index 00000000..3b5b3106 --- /dev/null +++ b/kassette.harformatcontent.json.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@amadeus-it-group/kassette](./kassette.md) > [HarFormatContent](./kassette.harformatcontent.md) > [json](./kassette.harformatcontent.json.md) + +## HarFormatContent.json property + +Response body saved as an object. + +**Signature:** + +```typescript +json?: any; +``` diff --git a/kassette.harformatcontent.md b/kassette.harformatcontent.md index 970708e7..460f0d3c 100644 --- a/kassette.harformatcontent.md +++ b/kassette.harformatcontent.md @@ -19,6 +19,7 @@ export interface HarFormatContent | [comment?](./kassette.harformatcontent.comment.md) | | string | _(Optional)_ Any comment as a string. This is not used by kassette. | | [compression?](./kassette.harformatcontent.compression.md) | | number | _(Optional)_ Number of bytes saved by compression. This is not implemented by kassette. | | [encoding?](./kassette.harformatcontent.encoding.md) | | string | _(Optional)_ Encoding used for the [text](./kassette.harformatcontent.text.md) field, such as "base64". | +| [json?](./kassette.harformatcontent.json.md) | | any | _(Optional)_ Response body saved as an object. | | [mimeType?](./kassette.harformatcontent.mimetype.md) | | string | _(Optional)_ Value of the Content-Type response header. | | [size?](./kassette.harformatcontent.size.md) | | number | _(Optional)_ Size of the content in bytes. | | [text?](./kassette.harformatcontent.text.md) | | string | _(Optional)_ Response body. | diff --git a/kassette.harformatpostdata.json.md b/kassette.harformatpostdata.json.md new file mode 100644 index 00000000..7b0b8dc1 --- /dev/null +++ b/kassette.harformatpostdata.json.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@amadeus-it-group/kassette](./kassette.md) > [HarFormatPostData](./kassette.harformatpostdata.md) > [json](./kassette.harformatpostdata.json.md) + +## HarFormatPostData.json property + +Response body saved as an object. + +**Signature:** + +```typescript +json?: any; +``` diff --git a/kassette.harformatpostdata.md b/kassette.harformatpostdata.md index e5a5b05e..77809f15 100644 --- a/kassette.harformatpostdata.md +++ b/kassette.harformatpostdata.md @@ -17,6 +17,7 @@ export interface HarFormatPostData | Property | Modifiers | Type | Description | | --- | --- | --- | --- | | [comment?](./kassette.harformatpostdata.comment.md) | | string | _(Optional)_ Any comment as a string. This is not used by kassette. | +| [json?](./kassette.harformatpostdata.json.md) | | any | _(Optional)_ Response body saved as an object. | | [mimeType?](./kassette.harformatpostdata.mimetype.md) | | string | _(Optional)_ Value of the Content-Type request header, if present. | | [params?](./kassette.harformatpostdata.params.md) | | any\[\] | _(Optional)_ List of posted parameters. This is not implemented in kassette. | | [text?](./kassette.harformatpostdata.text.md) | | string | _(Optional)_ Posted data, as a (binary) string. | diff --git a/kassette.imock.harmimetypesparsejson.md b/kassette.imock.harmimetypesparsejson.md new file mode 100644 index 00000000..70cff44a --- /dev/null +++ b/kassette.imock.harmimetypesparsejson.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@amadeus-it-group/kassette](./kassette.md) > [IMock](./kassette.imock.md) > [harMimeTypesParseJson](./kassette.imock.harmimetypesparsejson.md) + +## IMock.harMimeTypesParseJson property + +Used only when the [mocks format](./kassette.imock.mocksformat.md) is 'har', specifies a list of mime types that will attempt to parse the request/response body as JSON. This will only be applicable to request bodies if [saveInputRequestBody](./kassette.imock.saveinputrequestbody.md) is set to true Default value will be \[\] and will only be overridden by [setHarMimeTypesParseJson](./kassette.imock.setharmimetypesparsejson.md) + +**Signature:** + +```typescript +readonly harMimeTypesParseJson: string[]; +``` diff --git a/kassette.imock.md b/kassette.imock.md index 73f217a0..6037dda6 100644 --- a/kassette.imock.md +++ b/kassette.imock.md @@ -22,6 +22,7 @@ export interface IMock | [defaultLocalPath](./kassette.imock.defaultlocalpath.md) | readonly | string | Used only when the [mocks format](./kassette.imock.mocksformat.md) is 'folder', specifies the default local path of the mock, relative to [mocksFolder](./kassette.imock.mocksfolder.md), . It uses the URL pathname to build an equivalent folders hierarchy, and appends the HTTP method as a leaf folder. | | [defaultMockHarKey?](./kassette.imock.defaultmockharkey.md) | readonly | string | _(Optional)_ Used only when the [mocks format](./kassette.imock.mocksformat.md) is 'har', specifies the default mock har key to use in case [setMockHarKey](./kassette.imock.setmockharkey.md) is not called with a non-null value. It is computed by calling the [mocks har key manager](./kassette.imock.mocksharkeymanager.md) with the current request. | | [delay](./kassette.imock.delay.md) | readonly | number | The currently computed delay that will be applied, configured either by a call to [setDelay](./kassette.imock.setdelay.md), or by [the global setting](./kassette.cliconfigurationspec.delay.md). Note that if the delay is set to recorded and the local mock to use is not yet loaded, the value returned by this getter will be the default delay and not the recorded delay. | +| [harMimeTypesParseJson](./kassette.imock.harmimetypesparsejson.md) | readonly | string\[\] | Used only when the [mocks format](./kassette.imock.mocksformat.md) is 'har', specifies a list of mime types that will attempt to parse the request/response body as JSON. This will only be applicable to request bodies if [saveInputRequestBody](./kassette.imock.saveinputrequestbody.md) is set to true Default value will be \[\] and will only be overridden by [setHarMimeTypesParseJson](./kassette.imock.setharmimetypesparsejson.md) | | [localPath](./kassette.imock.localpath.md) | readonly | string | Used only when the [mocks format](./kassette.imock.mocksformat.md) is 'folder', specifies the local path of the mock, relative to [mocksFolder](./kassette.imock.mocksfolder.md). It is either the one set by the user through [setLocalPath](./kassette.imock.setlocalpath.md) or [defaultLocalPath](./kassette.imock.defaultlocalpath.md). | | [mockFolderFullPath](./kassette.imock.mockfolderfullpath.md) | readonly | string | Used only when the [mocks format](./kassette.imock.mocksformat.md) is 'folder', specifies the full, absolute path of the mock, built from [localPath](./kassette.imock.localpath.md)/[defaultLocalPath](./kassette.imock.defaultlocalpath.md), [mocksFolder](./kassette.imock.mocksfolder.md) and possibly [options.root](./kassette.mockingoptions.root.md) if [mocksFolder](./kassette.imock.mocksfolder.md) is not absolute. | | [mockHarKey?](./kassette.imock.mockharkey.md) | readonly | string | _(Optional)_ Used only when the [mocks format](./kassette.imock.mocksformat.md) is 'har', specifies the key to use inside the har file to either read or write a mock. | @@ -64,6 +65,7 @@ export interface IMock | [readOrFetchPayload()](./kassette.imock.readorfetchpayload.md) | Returns the wrapped local payload using [readLocalPayload](./kassette.imock.readlocalpayload.md) if it exists, otherwise use [fetchPayload](./kassette.imock.fetchpayload.md) and returns this wrapped payload. | | [sendResponse()](./kassette.imock.sendresponse.md) | Sends the response back to the client, with the previously specified delay if the payload origin is not remote. | | [setDelay(delay)](./kassette.imock.setdelay.md) | Sets the [delay](./kassette.imock.delay.md) that will be used to send the response to the client when the data is taken from the local mock. | +| [setHarMimeTypesParseJson(value)](./kassette.imock.setharmimetypesparsejson.md) | Sets the [harMimeTypesParseJson](./kassette.imock.harmimetypesparsejson.md) value. | | [setLocalPath(pathParts)](./kassette.imock.setlocalpath.md) | Sets the [localPath](./kassette.imock.localpath.md) value. | | [setMockHarKey(value)](./kassette.imock.setmockharkey.md) | Sets the [mockHarKey](./kassette.imock.mockharkey.md) value. | | [setMocksFolder(value)](./kassette.imock.setmocksfolder.md) | Sets the [mocksFolder](./kassette.imock.mocksfolder.md) value. | diff --git a/kassette.imock.setharmimetypesparsejson.md b/kassette.imock.setharmimetypesparsejson.md new file mode 100644 index 00000000..94095357 --- /dev/null +++ b/kassette.imock.setharmimetypesparsejson.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [@amadeus-it-group/kassette](./kassette.md) > [IMock](./kassette.imock.md) > [setHarMimeTypesParseJson](./kassette.imock.setharmimetypesparsejson.md) + +## IMock.setHarMimeTypesParseJson() method + +Sets the [harMimeTypesParseJson](./kassette.imock.harmimetypesparsejson.md) value. + +**Signature:** + +```typescript +setHarMimeTypesParseJson(value: string[]): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| value | string\[\] | The mime types that should attempt to parse the body as json | + +**Returns:** + +void +