vary.hpp

Type Aliases

using polycpp::vary::FieldList = std::vector<std::string>
using polycpp::vary::Headers = polycpp::http::Headers
using polycpp::vary::HeaderMap = Headers

Headers and HeaderMap both alias polycpp::http::Headers. HeaderMap is retained for source compatibility with early port drafts.

Functions

bool polycpp::vary::is_valid_field_name(std::string_view value)

Return true when value is a valid HTTP field-name token.

std::string polycpp::vary::append(std::string_view header, std::string_view field)

Append one field or comma-separated field list to a Vary header.

Throws:

polycpp::TypeError – when field is empty or contains invalid names.

Warning

doxygenfunction: Unable to resolve function “polycpp::vary::append” with arguments (std::string_view, const polycpp::vary::FieldList&) in doxygen xml output for project “vary” from directory: /home/runner/work/vary/vary/docs/build/doxygen/xml. Potential matches:

- std::string append(std::string_view header, const FieldList &fields)
- std::string append(std::string_view header, std::string_view field)

Warning

doxygenfunction: Unable to resolve function “polycpp::vary::vary” with arguments (polycpp::vary::Headers&, std::string_view) in doxygen xml output for project “vary” from directory: /home/runner/work/vary/vary/docs/build/doxygen/xml. Potential matches:

- template<typename Response> void vary(Response &response, const FieldList &fields)
- template<typename Response> void vary(Response &response, std::string_view field)
- void vary(Headers &headers, const FieldList &fields)
- void vary(Headers &headers, std::string_view field)

Warning

doxygenfunction: Unable to resolve function “polycpp::vary::vary” with arguments (polycpp::vary::Headers&, const polycpp::vary::FieldList&) in doxygen xml output for project “vary” from directory: /home/runner/work/vary/vary/docs/build/doxygen/xml. Potential matches:

- template<typename Response> void vary(Response &response, const FieldList &fields)
- template<typename Response> void vary(Response &response, std::string_view field)
- void vary(Headers &headers, const FieldList &fields)
- void vary(Headers &headers, std::string_view field)

Response-like overloads

vary also provides templated overloads for response-like objects with these methods:

  • getHeader("Vary") returning string header values

  • getHeaderNames() returning the currently set header names

  • setHeader(name, value) mutating the response header

The overloads are intended for polycpp::http::ServerResponse-style handles without requiring a JavaScript duck-typed response object.