Skip to content

Commit 61e6406

Browse files
committed
add header count
1 parent 59a8a48 commit 61e6406

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/graphql-playground/src/components/Playground/GraphQLEditor.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,17 @@ export class GraphQLEditor extends React.PureComponent<
336336
this.storageSet('variableEditorHeight', this.state.variableEditorHeight)
337337
}
338338

339+
getHeaderCount() {
340+
try {
341+
const headers = JSON.parse(this.props.session.headers!)
342+
return `(${Object.keys(headers).length})`
343+
} catch (e) {
344+
//
345+
}
346+
347+
return ''
348+
}
349+
339350
render() {
340351
const children = React.Children.toArray(this.props.children)
341352
const footer = find(children, child => child.type === GraphQLEditor.Footer)
@@ -516,7 +527,7 @@ export class GraphQLEditor extends React.PureComponent<
516527
ref={this.setHttpHeadersRef}
517528
onClick={this.selectHttpHeaders}
518529
>
519-
{'HTTP Headers'}
530+
{'HTTP Headers ' + this.getHeaderCount()}
520531
</span>
521532
</div>
522533
{this.state.queryVariablesActive ? (

0 commit comments

Comments
 (0)