• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cle-b / httpdbg / 14431392965

13 Apr 2025 04:45PM UTC coverage: 85.832% (-2.5%) from 88.306%
14431392965

Pull #191

github

cle-b
format
Pull Request #191: POC - trace HTTP requests in go

50 of 127 new or added lines in 6 files covered. (39.37%)

2090 of 2435 relevant lines covered (85.83%)

0.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.35
/httpdbg/hooks/all.py
1
# -*- coding: utf-8 -*-
2
from contextlib import contextmanager
1✔
3
from typing import Generator
1✔
4
from typing import List
1✔
5
from typing import Tuple
1✔
6
from typing import Union
1✔
7

8
from httpdbg.hooks.aiohttp import hook_aiohttp
1✔
9
from httpdbg.hooks.external import watcher_external
1✔
10
from httpdbg.hooks.fastapi import hook_fastapi
1✔
11
from httpdbg.hooks.flask import hook_flask
1✔
12
from httpdbg.hooks.generic import hook_generic
1✔
13
from httpdbg.hooks.http import hook_http
1✔
14
from httpdbg.hooks.httpx import hook_httpx
1✔
15
from httpdbg.hooks.go import watcher_go
1✔
16
from httpdbg.hooks.pytest import hook_pytest
1✔
17
from httpdbg.hooks.requests import hook_requests
1✔
18
from httpdbg.hooks.socket import hook_socket
1✔
19
from httpdbg.hooks.starlette import hook_starlette
1✔
20
from httpdbg.hooks.unittest import hook_unittest
1✔
21
from httpdbg.hooks.urllib3 import hook_urllib3
1✔
22
from httpdbg.hooks.uvicorn import hook_uvicorn
1✔
23

24
from httpdbg.records import HTTPRecords
1✔
25

26

27
@contextmanager
1✔
28
def httprecord(
1✔
29
    records: HTTPRecords = None,
30
    initiators: Union[List[str], None] = None,
31
    client: bool = True,
32
    server: bool = False,
33
    ignore: Union[List[Tuple[str, int]], None] = None,
34
    go: bool = False,
35
) -> Generator[HTTPRecords, None, None]:
36
    if records is None:
1✔
37
        records = HTTPRecords(client=client, server=server, ignore=ignore)
1✔
38

39
    if not go:
1✔
40
        with watcher_external(records, initiators, server):
1✔
41
            with hook_flask(records):
1✔
42
                with hook_socket(records):
1✔
43
                    with hook_fastapi(records):
1✔
44
                        with hook_starlette(records):
1✔
45
                            with hook_uvicorn(records):
1✔
46
                                with hook_http(records):
1✔
47
                                    with hook_httpx(records):
1✔
48
                                        with hook_requests(records):
1✔
49
                                            with hook_urllib3(records):
1✔
50
                                                with hook_aiohttp(records):
1✔
51
                                                    with hook_pytest(records):
1✔
52
                                                        with hook_unittest(records):
1✔
53
                                                            with hook_generic(
1✔
54
                                                                records, initiators
55
                                                            ):
56
                                                                yield records
1✔
57
    else:
58
        # if we trace the HTTP requests in go process, there is no reason to hook the Python call
NEW
59
        with watcher_go(records):
×
NEW
60
            yield records
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc