Skip to content

Commit

Permalink
usebruno#2757: Visualize if request body, script or tests have content
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Ziermann committed Aug 11, 2024
1 parent 7e305be commit 6677ee2
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ const HttpRequestPane = ({ item, collection, leftPaneWidth }) => {

const isMultipleContentTab = ['params', 'script', 'vars', 'auth', 'docs'].includes(focusedTab.requestPaneTab);

// get the length of active params, headers, asserts and vars
// get the length of active params, headers, asserts and vars as well as the contents of the body, tests and script
const params = item.draft ? get(item, 'draft.request.params', []) : get(item, 'request.params', []);
const body = item.draft ? get(item, 'draft.request.body', []) : get(item, 'request.body', []);
const headers = item.draft ? get(item, 'draft.request.headers', []) : get(item, 'request.headers', []);
const script = item.draft ? get(item, 'draft.request.script', []) : get(item, 'request.script', []);
const assertions = item.draft ? get(item, 'draft.request.assertions', []) : get(item, 'request.assertions', []);
const tests = item.draft ? get(item, 'draft.request.tests', []) : get(item, 'request.tests', []);
const requestVars = item.draft ? get(item, 'draft.request.vars.req', []) : get(item, 'request.vars.req', []);
const responseVars = item.draft ? get(item, 'draft.request.vars.res', []) : get(item, 'request.vars.res', []);

Expand All @@ -105,6 +108,7 @@ const HttpRequestPane = ({ item, collection, leftPaneWidth }) => {
</div>
<div className={getTabClassname('body')} role="tab" onClick={() => selectTab('body')}>
Body
{body.mode !== 'none' && <sup className="ml-1 font-medium">&#9679;</sup>}
</div>
<div className={getTabClassname('headers')} role="tab" onClick={() => selectTab('headers')}>
Headers
Expand All @@ -119,13 +123,15 @@ const HttpRequestPane = ({ item, collection, leftPaneWidth }) => {
</div>
<div className={getTabClassname('script')} role="tab" onClick={() => selectTab('script')}>
Script
{(script.req || script.res) && <sup className="ml-1 font-medium">&#9679;</sup>}
</div>
<div className={getTabClassname('assert')} role="tab" onClick={() => selectTab('assert')}>
Assert
{activeAssertionsLength > 0 && <sup className="ml-1 font-medium">{activeAssertionsLength}</sup>}
</div>
<div className={getTabClassname('tests')} role="tab" onClick={() => selectTab('tests')}>
Tests
{tests && <sup className="ml-1 font-medium">&#9679;</sup>}
</div>
<div className={getTabClassname('docs')} role="tab" onClick={() => selectTab('docs')}>
Docs
Expand Down

0 comments on commit 6677ee2

Please sign in to comment.