You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace the v1 insert-on-miss accessors on http_response with
const, string_view-returning lookups that do NOT mutate the underlying
maps. Fixes PRD-RSP-REQ-002 (callable on const&) and
PRD-RSP-REQ-003 (no insert on miss).
Changes:
- http_utils.hpp: add `is_transparent` to header_comparator so
header_map::find(string_view) is a heterogeneous lookup.
- http_response.hpp:
* get_header / get_footer / get_cookie now take string_view, are
const, and return std::string_view (empty on miss).
* get_headers / get_footers / get_cookies marked noexcept and
return const http::header_map&.
* Add get_status() (noexcept) as the v2 spelling of the status
code accessor; get_response_code() retained as a compatibility
alias while v1 subclasses still inherit (TASK-013 removes both
together with webserver.cpp:1336's dispatch path).
* Lifetime contract documented above the single-key accessors.
- http_response.cpp: out-of-line definitions for the three single-key
accessors via a shared header_map_find_view helper.
- test/unit/http_response_test.cpp: add 11 tests covering const
callability, no-insert-on-miss for headers/footers/cookies, empty
view on miss, read-back after with_header from const&, get_status
/ kind / get_headers noexcept, single-key accessors take
string_view, case-insensitive lookup, view reflects replacement.
Also tighten existing `auto headers = resp.get_headers()` lines
to `const auto&` (avoids needless map copies now that the
accessor returns by reference).
- test/integ/basic.cpp: silence -Werror,-Wunused-variable on the
smoke `auto checksum = response->get_footer(...)` line; the
variable was harmless under the v1 const-string& return but a
string_view dtor is trivial so the warning now fires.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments