Skip to main content

seedfaker_core/gen/
http_method.rs

1use crate::ctx::GenContext;
2
3/// Weighted HTTP method distribution based on real-world traffic analysis.
4/// GET dominates (~63%), POST second (~22%), rest are rare.
5pub fn gen(ctx: &mut GenContext<'_>, buf: &mut String) {
6    let w = ctx.rng.urange(0, 99);
7    buf.push_str(match w {
8        0..=62 => "GET",     // 63%
9        63..=84 => "POST",   // 22%
10        85..=89 => "PUT",    //  5%
11        90..=93 => "DELETE", //  4%
12        94..=96 => "PATCH",  //  3%
13        97..=98 => "HEAD",   //  2%
14        _ => "OPTIONS",      //  1%
15    });
16}