Skip to content

feat: add HTTP headers and request data model - #11

Merged
zuudevs merged 12 commits into
mainfrom
feat/http-data-model
Sep 14, 2026
Merged

zuudevs merged 12 commits into
mainfrom
feat/http-data-model

Conversation

@zuudevs

@zuudevs zuudevs commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Summary

Adds the first public HTTP data-model types required by request serialization and response parsing.

Added

  • include/cpp_request/headers.hpp
    • owning ordered header storage
    • duplicate fields preserved
    • ASCII case-insensitive contains() / get()
    • get() returns the first matching value
    • set() replaces all matching fields with one value
    • const iteration in insertion order
  • src/headers.cpp
    • allocation-free case-insensitive lookup
    • safe self-referential set() input handling
  • include/cpp_request/request.hpp
    • v1 Method enum: GET, HEAD, POST, PUT, PATCH, DELETE
    • borrowed URL and body via std::string_view
    • owned Headers
    • mutable/const header access
  • tests/headers_test.cpp
    • duplicate and insertion-order behavior
    • case-insensitive first-match lookup
    • set() replacement semantics
    • owned header storage
  • tests/request_test.cpp
    • method coverage
    • borrowed URL/body behavior
    • independently owned request headers
    • const accessors

Ownership model

Request intentionally does not copy URL or body data. Those remain borrowed for the synchronous v1 execution model. Headers owns inserted names and values so callers may safely pass temporary/source strings without retaining their storage.

Scope

This PR intentionally does not serialize HTTP/1.1 bytes, validate outgoing header syntax, parse responses, or execute requests through Client. The next HTTP-layer PR can build the request serializer directly on these types.

@zuudevs
zuudevs merged commit 857dd20 into main Sep 14, 2026
6 checks passed
@zuudevs
zuudevs deleted the feat/http-data-model branch September 14, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant