Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
http_mutator = EnhancedHTTPMutator(
requests=args.requests,
stub_responses=args.stub_responses,
overrideheaders=overrideheaders)
graphiql_sender = GraphiQLSenderAction(omnimenu=graphiql_omnimenu, http_mutator=http_mutator)
custom_header_setter = CustomHeaderSetterAction(overrideheaders=overrideheaders, text="Set Custom Header")
cfg = [
['Proxy', args.proxy],
['Authorization Key', args.key],
['Load Placeholders', args.detect],
['Generate HTML DOC', args.generate_html],
['Generate Schema DOC', args.generate_schema],
['Generate Stub Queries', args.generate_queries],
['Accept Invalid SSL Certificate', args.insecure_certificate]
]
return GraphQLPanel(
actions=[custom_header_setter, graphiql_sender],
restore=json.dumps({'config': cfg}),
http_mutator=None,
requests=args.requests,
stub_responses=args.stub_responses
).app()
else:
return init(args, lambda: parser.print_help())
def getUiComponent(self):
"""
Override ITab method
:return: Tab UI Component
"""
overrideheaders = {}
repeater_omnimenu = OmniMenuItem(callbacks=self._callbacks, helpers=self._helpers, text="Send to Repeater")
graphiql_omnimenu = OmniMenuItem(callbacks=self._callbacks, helpers=self._helpers, text="Send to GraphiQL")
http_mutator = EnhancedHTTPMutator(
callbacks=self._callbacks, helpers=self._helpers, overrideheaders=overrideheaders)
repeater_sender = RepeaterSenderAction(omnimenu=repeater_omnimenu, http_mutator=http_mutator)
graphiql_sender = GraphiQLSenderAction(omnimenu=graphiql_omnimenu, http_mutator=http_mutator)
custom_header_setter = CustomHeaderSetterAction(overrideheaders=overrideheaders, text="Set Custom Header")
try:
restore = self._callbacks.loadExtensionSetting(GraphQLPanel.__name__)
except Exception as ex:
print("Cannot restore state! %s" % ex)
restore = None
proxy = None
for request_listener in json.loads(self._callbacks.saveConfigAsJson())["proxy"]["request_listeners"]:
if request_listener["running"]:
proxy = "localhost:%s" % request_listener["listener_port"]
break
self.panel = GraphQLPanel(
actions=[
repeater_sender,
graphiql_sender,
custom_header_setter],
def __init__(self, text):
self.requests = {}
self.menuitem = JMenuItem(text)
self.menuitem.addActionListener(self)
self.enabled = True
self.menuitem.setEnabled(self.enabled)
def actionPerformed(self, e):
self.enabled = not self.enabled
self.menuitem.setEnabled(self.enabled)
def ctx(self, host=None, payload=None, fname=None):
pass
print("Changing dir to %s" % tmpdir)
os.chdir(tmpdir)
GraphQLPanel(actions=[TestAction("test it")]).app()
graphiql_sender = GraphiQLSenderAction(omnimenu=graphiql_omnimenu, http_mutator=http_mutator)
custom_header_setter = CustomHeaderSetterAction(overrideheaders=overrideheaders, text="Set Custom Header")
try:
restore = self._callbacks.loadExtensionSetting(GraphQLPanel.__name__)
except Exception as ex:
print("Cannot restore state! %s" % ex)
restore = None
proxy = None
for request_listener in json.loads(self._callbacks.saveConfigAsJson())["proxy"]["request_listeners"]:
if request_listener["running"]:
proxy = "localhost:%s" % request_listener["listener_port"]
break
self.panel = GraphQLPanel(
actions=[
repeater_sender,
graphiql_sender,
custom_header_setter],
restore=restore,
proxy=proxy,
http_mutator=http_mutator,
texteditor_factory=self._callbacks.createTextEditor
)
self._callbacks.customizeUiComponent(self.panel.this)
return self.panel.this