MCPcopy Index your code
hub / github.com/httpie/cli / httpie

Function httpie

tests/utils/__init__.py:290–323  ·  view source on GitHub ↗

Run HTTPie manager command with the given args/kwargs, and capture stderr/out and exit status.

(
    *args,
    **kwargs
)

Source from the content-addressed store, hash-verified

288
289
290def httpie(
291 *args,
292 **kwargs
293) -> StrCLIResponse:
294 """
295 Run HTTPie manager command with the given
296 args/kwargs, and capture stderr/out and exit
297 status.
298 """
299
300 env = kwargs.setdefault('env', MockEnvironment())
301 cli_args = ['httpie']
302 if not kwargs.pop('no_debug', False):
303 cli_args.append('--debug')
304 cli_args += normalize_args(args)
305 exit_status = manager.main(
306 args=cli_args,
307 **kwargs
308 )
309
310 env.stdout.seek(0)
311 env.stderr.seek(0)
312 try:
313 response = BaseCLIResponse.from_raw_data(env.stdout.read())
314 response.stderr = env.stderr.read()
315 response.exit_status = exit_status
316 response.args = cli_args
317 finally:
318 env.stdout.truncate(0)
319 env.stderr.truncate(0)
320 env.stdout.seek(0)
321 env.stderr.seek(0)
322
323 return response
324
325
326def http(

Calls 3

MockEnvironmentClass · 0.85
normalize_argsFunction · 0.85
from_raw_dataMethod · 0.80