Skip to content

Add string-based accessors for Request method - #108

Open
harmony7 wants to merge 1 commit into
mainfrom
kats/method-string-accessors
Open

Add string-based accessors for Request method#108
harmony7 wants to merge 1 commit into
mainfrom
kats/method-string-accessors

Conversation

@harmony7

@harmony7 harmony7 commented Sep 7, 2026

Copy link
Copy Markdown
Member

Method::get_method()/set_method()/with_method() only support the 9 standard HTTP verbs via the Method enum, which cannot represent nonstandard-but-common verbs like PURGE.

This PR adds get_method_str(), Request::create(), and string overloads of set_method()/with_method() that accept any valid HTTP method token, backed by the fastly crate's existing impl ToMethod support for strings. Invalid tokens are
reported via a new FastlyErrorCode::InvalidMethod rather than panicking.

Fixes #88

NOTE: get_method() will panic if the method is not one of the nine. The right way to fix this is probably to change that function's signature to return expected<>, but that would be breaking.

@harmony7
harmony7 requested review from TartanLlama and zkat September 7, 2026 05:20
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.

Method needs string accessors

1 participant