{"record":{"id":"178a3bf1fe6c666e","repo":"vectordotdev/vector","slug":"should-not-fail-to-convert-method-to-method-filter","errorCode":null,"errorMessage":"should not fail to convert method to method filter","messagePattern":"should not fail to convert method to method filter","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/components/validation/resources/http.rs","lineNumber":496,"sourceCode":"    let server_notifier = Arc::clone(&resource_notifier);\n\n    let output_runner_metrics = Arc::clone(runner_metrics);\n\n    tokio::spawn(async move {\n        // Create our HTTP server by binding as early as possible to return an error if we can't\n        // actually bind.\n        let server_builder =\n            Server::try_bind(&listen_addr).expect(\"Failed to bind to listen address.\");\n\n        // Create our router, which is a bit boilerplate-y because we take the HTTP method\n        // parametrically. We generate a handler that calls the given `handler` and then triggers\n        // the notifier shared by the HTTP server and the resource's core logic loop.\n        //\n        // Every time a request is processed, we notify the core logic loop so it can continue\n        // checking to see if it's time to fully close once all input events have been consumed and\n        // the input receiver is closed.\n        let method_filter = MethodFilter::try_from(request_method)\n            .expect(\"should not fail to convert method to method filter\");\n        let method_router = MethodRouter::new()\n            .fallback(|req: Request<Body>| async move {\n                error!(\n                    path = req.uri().path(),\n                    method = req.method().as_str(),\n                    \"Component sent request to a different path/method than expected.\"\n                );\n\n                StatusCode::METHOD_NOT_ALLOWED\n            })\n            .on(method_filter, move |request: Request<Body>| {\n                let request_handler = handler(request, output_runner_metrics);\n                let notifier = Arc::clone(&server_notifier);\n\n                async move {\n                    let response = request_handler.await;\n                    notifier.notify_one();\n                    response","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/components/validation/resources/http.rs#L478-L514","documentation":"The validation HTTP server converts the configured request method into an Axum `MethodFilter` and expects it to always succeed, since the method comes from internal configuration using a valid HTTP verb. A panic means the method string supplied was not a convertible HTTP method value.","triggerScenarios":"`spawn_http_server` given a `request_method` that `MethodFilter::try_from` cannot convert — e.g. a non-standard or invalid HTTP method string from the test-case resource configuration.","commonSituations":"Typo'd method in a validation test case (e.g. \"GETT\", \"get \" with whitespace); custom builds feeding non-standard verbs; config parsing regression.","solutions":["Correct the HTTP method in the validation test case to a standard verb (GET/POST/PUT/DELETE/PATCH/HEAD/OPTIONS)","Ensure no whitespace or case/format oddities in the configured method string","Update Vector if a standard method fails on current code (report as a bug)"],"exampleFix":"// before\nmethod = \"GETT\"\n// after\nmethod = \"GET\"","handlingStrategy":"validation","validationCode":"// check method is a standard HTTP verb before running\nconst VALID = [\"GET\",\"POST\",\"PUT\",\"DELETE\",\"PATCH\",\"HEAD\",\"OPTIONS\"];\nif (!VALID.includes(method.toUpperCase().trim())) throw new Error(`invalid method: ${method}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy method names from the HTTP spec, avoid typos","Trim whitespace from configured values","Restrict test-case configs to standard verbs"],"tags":["rust","validation","http","axum","method"],"backgroundTag":"invalid-enum-value","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}