{"record":{"id":"cfc3a71e23d2b3cb","repo":"stalwartlabs/stalwart","slug":"the-http-method-is-not-supported-by-this-endpoint","errorCode":null,"errorMessage":"The HTTP method is not supported by this endpoint, allowed methods are {allow}.","messagePattern":"The HTTP method is not supported by this endpoint, allowed methods are (.+?)\\.","errorType":"http","errorClass":"ScimError","httpStatus":405,"severity":"error","filePath":"crates/scim/src/request.rs","lineNumber":281,"sourceCode":"    fetch_body(req, max_size, session.session_id)\n        .await\n        .ok_or_else(|| {\n            ScimResponseError::Scim(Error::new(413).with_detail(format!(\n                \"The size of the request payload exceeds the maximum of {max_size} bytes.\"\n            )))\n        })\n}\n\npub fn search_request(query: Option<&str>) -> Result<SearchRequest<'_>> {\n    match query {\n        Some(query) => SearchRequest::from_query(query).map_err(Into::into),\n        None => Ok(SearchRequest::default()),\n    }\n}\n\npub fn method_not_allowed(allow: &'static str) -> ScimResponseError {\n    ScimResponseError::Allow(\n        Error::new(405).with_detail(format!(\n            \"The HTTP method is not supported by this endpoint, allowed methods are {allow}.\"\n        )),\n        allow,\n    )\n}\n\nfn assert_unfiltered(req: &HttpRequest) -> Result<()> {\n    if SearchRequest::from_query(req.uri().query().unwrap_or_default())\n        .is_ok_and(|request| request.filter.is_some())\n    {\n        Err(Error::forbidden(\n            \"The discovery endpoints do not support filtering, remove the 'filter' parameter.\",\n        )\n        .into())\n    } else {\n        Ok(())\n    }\n}","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/stalwartlabs/stalwart/blob/e96200385781a6a9995a8b839ac27d6c75a983ee/crates/scim/src/request.rs#L263-L299","documentation":"A SCIM 405 error built by `method_not_allowed(allow)` in crates/scim/src/request.rs. It is returned when an HTTP method is routed to a SCIM endpoint that does not support it, and the Allow variant also advertises the permitted methods via the HTTP Allow header.","triggerScenarios":"`dispatch_scim_request` matches a valid SCIM path but the request's HTTP method is not one the endpoint supports (e.g. DELETE on /Users, POST on /Users/{id}, or PUT on /ServiceProviderConfig), so it calls this constructor with the allowed method list.","commonSituations":"A client uses PUT to update part of a user where only PATCH/PUT-on-full-resource is allowed; sending POST to an individual resource URL instead of the collection; automation scripts reusing the wrong method for an endpoint.","solutions":["Use only the methods listed in the error detail / Allow header for that endpoint (e.g. GET/PUT/PATCH/DELETE on /Users/{id}; POST only on /Users).","Fix the client's request builder so the method matches the operation semantics (create = POST to collection, update = PUT/PATCH to resource).","Check RFC 7644 section 3 for the per-endpoint method matrix before integrating a new endpoint."],"exampleFix":"// before\nclient.request(Method::POST, \"/Users/2819c223...\").body(user).send().await?;\n// after\nclient.request(Method::PUT, \"/Users/2819c223...\").body(user).send().await?;","handlingStrategy":"validation","validationCode":"const ENDPOINT_METHODS: &[(&str, &[Method])] = &[\n    (\"/Users\", &[Method::GET, Method::POST]),\n    (\"/Users/{id}\", &[Method::GET, Method::PUT, Method::PATCH, Method::DELETE]),\n];\nassert!(allowed_methods_for(path).contains(&method), \"unsupported method for {path}\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Encode the RFC 7644 method-per-endpoint matrix in your client wrapper.","Parse the Allow header on 405 responses to self-correct.","Use distinct helper functions per operation (create/update/delete) so methods can't be mixed up."],"tags":["scim","http-405","method-not-allowed"],"backgroundTag":"http-error-response","analyzedSha":"e96200385781a6a9995a8b839ac27d6c75a983ee","analyzedAt":"2026-09-06T22:07:17.982Z","contentChangedAt":"2026-09-06T22:07:17.982Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}