Skip to content

Implement Response::see_other/redirect/temporary_redirect - #107

Open
harmony7 wants to merge 1 commit into
mainfrom
kats/response-redirect-helpers
Open

Implement Response::see_other/redirect/temporary_redirect#107
harmony7 wants to merge 1 commit into
mainfrom
kats/response-redirect-helpers

Conversation

@harmony7

Copy link
Copy Markdown
Member

These three static constructors were declared in include/fastly/http/response.h (lines 142, 154, 166) and had working Rust wrappers and cxx bridge declarations (src/http/response.rs, src/lib.rs), but were never defined in the public C++ layer.

Because a declaration without a definition is legal C++ and nothing in the repo called them, the whole build and test suite passed with the gap in place; any user calling one got an undefined symbol link error instead of a compile error:

wasm-ld: error: undefined symbol:
  fastly::http::Response::redirect(std::string_view)

These three static constructors were declared in `include/fastly/http/response.h`
(lines 142, 154, 166) and had working Rust wrappers and cxx bridge declarations
(`src/http/response.rs`, `src/lib.rs`), but were never defined in the public C++
layer. Because a declaration without a definition is legal C++ and nothing in the
repo called them, the whole build and test suite passed with the gap in place;
any user calling one got an `undefined symbol` link error instead of a compile
error:

    wasm-ld: error: undefined symbol:
      fastly::http::Response::redirect(std::string_view)

The three definitions mirror the existing `Response::from_status`, passing the
destination across the bridge with `static_cast<std::string>` per the bridge's
string convention.

Adds test/response_redirect.cpp asserting the `Location` header for each, plus a
non-null-terminated `string_view` case to cover the conversion. The status codes
these set (303/308/307) are not asserted because `Response::get_status()` does
not exist on this branch; those assertions belong with the get_status work.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@harmony7
harmony7 requested review from TartanLlama and zkat August 24, 2026 13:31
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