MCPcopy Create free account
hub / github.com/bytecodealliance/wstd / to_wasi_method

Function to_wasi_method

src/http/method.rs:6–19  ·  view source on GitHub ↗
(value: Method)

Source from the content-addressed store, hash-verified

4use http::method::InvalidMethod;
5
6pub(crate) fn to_wasi_method(value: Method) -> WasiMethod {
7 match value {
8 Method::GET => WasiMethod::Get,
9 Method::HEAD => WasiMethod::Head,
10 Method::POST => WasiMethod::Post,
11 Method::PUT => WasiMethod::Put,
12 Method::DELETE => WasiMethod::Delete,
13 Method::CONNECT => WasiMethod::Connect,
14 Method::OPTIONS => WasiMethod::Options,
15 Method::TRACE => WasiMethod::Trace,
16 Method::PATCH => WasiMethod::Patch,
17 other => WasiMethod::Other(other.as_str().to_owned()),
18 }
19}
20
21pub(crate) fn from_wasi_method(value: WasiMethod) -> Result<Method, InvalidMethod> {
22 Ok(match value {

Callers 1

try_into_outgoingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected