# ptrhng/httpcheck architecture

> Architecture diagram of the GitHub repository ptrhng/httpcheck, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ptrhng/httpcheck
- Repository: https://github.com/ptrhng/httpcheck

## Overview

##### Main Components

a) Command Line Interface Layer
- Arguments Parser (args.go)
- Options Handler (options.go)
- Command Processor (command.go)

b) Core Processing Layer
- HTTP Request Builder
- Trace Handler (trace.go)
- Performance Measurement Engine

c) Output Layer
- Response Printer (printer.go)
- Performance Metrics Display

##### Component Relationships

**[User Input] → [CLI Layer] → [Core Processing] → [Output Layer] → [User Display]**

##### Detailed Component Breakdown

a) Input Processing (Blue Rectangle)
- Request Item Parser
- HTTP Method Handler
- Header/Query/Data Processors

b) HTTP Processing (Green Rectangle)
- Request Builder
- Performance Tracer
- Response Handler

c) Output Processing (Orange Rectangle)
- Response Formatter
- Performance Metrics Calculator
- Formatter

- User input → Arguments Parser
- Arguments Parser → Request Builder
- Request Builder → HTTP Client
- HTTP Client → Performance Tracer
- Performance Tracer → Response Printer
- Response Printer → User Display

##### Technical Details

Annotations for:
- Go HTTP Client usage
- Performance metrics being collected
- Support for different data formats (JSON, Form)
- Custom HTTP methods support

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef cli fill:#b3d1ff,stroke:#333,stroke-width:2px
    classDef core fill:#90EE90,stroke:#333,stroke-width:2px
    classDef output fill:#FFB366,stroke:#333,stroke-width:2px
    classDef storage fill:#E6E6E6,stroke:#333,stroke-width:2px
    classDef input fill:#FFE6CC,stroke:#333,stroke-width:2px

    %% Input Layer
    UserInput[User Input]:::input

    %% CLI Layer
    subgraph CLI
        Main[Main Entry]:::cli
        ArgsParser[Arguments Parser]:::cli
        OptHandler[Options Handler]:::cli
        CmdProc[Command Processor]:::cli
    end

    %% Core Processing Layer
    subgraph CoreProcessing
        ReqBuilder[HTTP Request Builder]:::core
        TraceHandler[Trace Handler]:::core
        PerfEngine[Performance Measurement Engine]:::core
        HTTPClient[HTTP Client]:::core
    end

    %% Output Layer
    subgraph Output
        RespPrinter[Response Printer]:::output
        MetricsDisplay[Performance Metrics Display]:::output
        UserDisplay[User Display]:::output
    end

    %% Test Data Storage
    subgraph TestData
        HTTPTests[HTTP Response Tests]:::storage
        HTTPSTests[HTTPS Response Tests]:::storage
        RespBodyTests[Response Body Tests]:::storage
        DisplayTests[Display Tests]:::storage
    end

    %% Relationships
    UserInput --> Main
    Main --> ArgsParser
    ArgsParser --> OptHandler
    OptHandler --> CmdProc
    CmdProc --> ReqBuilder
    ReqBuilder --> HTTPClient
    HTTPClient --> TraceHandler
    TraceHandler --> PerfEngine
    PerfEngine --> RespPrinter
    RespPrinter --> MetricsDisplay
    MetricsDisplay --> UserDisplay

    %% Click Events
    click Main "https://github.com/ptrhng/httpcheck/blob/main/main.go"
    click ArgsParser "https://github.com/ptrhng/httpcheck/blob/main/args.go"
    click OptHandler "https://github.com/ptrhng/httpcheck/blob/main/options.go"
    click CmdProc "https://github.com/ptrhng/httpcheck/blob/main/command.go"
    click TraceHandler "https://github.com/ptrhng/httpcheck/blob/main/trace.go"
    click RespPrinter "https://github.com/ptrhng/httpcheck/blob/main/printer.go"
    click HTTPTests "https://github.com/ptrhng/httpcheck/blob/main/testdata/http.golden"
    click HTTPSTests "https://github.com/ptrhng/httpcheck/blob/main/testdata/https.golden"
    click RespBodyTests "https://github.com/ptrhng/httpcheck/blob/main/testdata/response_body.txt"
    click DisplayTests "https://github.com/ptrhng/httpcheck/blob/main/testdata/showbody.golden"
    click TestData "https://github.com/ptrhng/httpcheck/tree/main/testdata/"

    %% Legend
    subgraph Legend
        L1[CLI Components]:::cli
        L2[Core Processing]:::core
        L3[Output Components]:::output
        L4[Storage Components]:::storage
        L5[Input Components]:::input
    end
```
