Skip to content

Commit

Permalink
refactor: change name of render size threshold config
Browse files Browse the repository at this point in the history
  • Loading branch information
kristiansamuelsson committed Mar 6, 2024
1 parent f088944 commit a875658
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/usage/configuration.md
Expand Up @@ -208,7 +208,7 @@ Parameter name | Docker variable | Description
</tr>
<tr>
<td>
<a name="user-content-renderSizeThreshold"></a><code>renderSizeThreshold</code>
<a name="user-content-payload.render.sizeThreshold"></a><code>payload.render.sizeThreshold</code>
</td>
<td><em>Unavailable</em></td>
<td>The maximum size (in bytes) of a payload to render.
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/highlight-code.jsx
Expand Up @@ -9,7 +9,7 @@ import { CopyToClipboard } from "react-copy-to-clipboard"

const HighlightCode = ({value, fileName = "response.txt", className, downloadable, getConfigs, canCopy, language}) => {
const config = isFunction(getConfigs) ? getConfigs() : null
const renderSizeThreshold = get(config, "renderSizeThreshold")
const renderSizeThreshold = get(config, "payload.render.sizeThreshold")
const canSyntaxHighlight = get(config, "syntaxHighlight") !== false && get(config, "syntaxHighlight.activated", true)
const syntaxHighlightSizeThreshold = canSyntaxHighlight ? get(config, "syntaxHighlight.sizeThreshold", undefined) : undefined
const rootRef = useRef(null)
Expand Down
10 changes: 7 additions & 3 deletions test/unit/components/highlight-code.jsx
Expand Up @@ -9,10 +9,14 @@ const defaultSyntaxHighlightConfig = {
}

const fakeGetConfigs = (
renderSizeThreshold = undefined,
syntaxHighlight = defaultSyntaxHighlightConfig) => (
renderSizeThreshold = undefined,
syntaxHighlight = defaultSyntaxHighlightConfig) => (
{
renderSizeThreshold: renderSizeThreshold,
payload: {
render: {
sizeThreshold: renderSizeThreshold,
}
},
syntaxHighlight: syntaxHighlight
})

Expand Down

0 comments on commit a875658

Please sign in to comment.