Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/1602/witness
https://github.com/1602/witness
Last synced: 23 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/1602/witness
- Owner: 1602
- License: apache-2.0
- Created: 2019-03-25T19:58:01.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-03-12T22:19:34.000Z (11 months ago)
- Last Synced: 2024-11-28T08:05:44.962Z (3 months ago)
- Language: Go
- Size: 86.9 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://goreportcard.com/report/github.com/1602/witness)
[](https://travis-ci.org/1602/witness)
[](https://coveralls.io/github/1602/witness?branch=main)## Witness
Enables debugging of http requests via UI. It is like chrome devtools for go backend.
## How it works
It uses `httptrace.WithClientTrace` to make a `http.RoundTripper` eavesdropping on http connection. This allows detailed analysis of various http request stages. All information gathered then pushed using EventStream to UI running in browser.
## Usage
The idea is to observe http client you want to debug by calling `witness.DebugClient` with the http client in question. For example, if you "own" a client to make http calls to some API:
```
// init http client with any configuration you need
cl := &http.Client{}// pass client to witness to wrap its Transport with eavesdropping functionality
// it will also start SSE notification channel
witness.DebugClient(cl)// then use cl as http client for making request
```Alternatively, is you are interested in behaviour of some third-party http client, k8s client for example, you could eavesdrop on http client created by k8s go client code.
TODO: make demo of k8s client eavesdropping