惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
L
LangChain Blog
Jina AI
Jina AI
爱范儿
爱范儿
C
Check Point Blog
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
月光博客
月光博客
GbyAI
GbyAI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Stack Overflow Blog
Stack Overflow Blog
V
V2EX
A
About on SuperTechFans
有赞技术团队
有赞技术团队
Microsoft Azure Blog
Microsoft Azure Blog
The GitHub Blog
The GitHub Blog
博客园 - Franky
Apple Machine Learning Research
Apple Machine Learning Research
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题

The Rust Programming Language Forum - Latest posts

What's everyone working on this week (21/2026)? Rust Function Call with one Param Iced + Canvas + Text: How do I create a style for canvas text "Value dropped while borrowed" as a lifetime mismatch Weird `use of moved value` behaviour Slightly surprising behavior of a while loop Clap: how to disable options after a certain positional argument How do i tell rust-analyzer what kind of bracket to use for a macro? Iterator + Borrow Checker: Work around borrowing already borrowed mutable variable Requesting data via mavlink SKILLS.md for Rust development 🧵 Stringlet UTF-8 Hack Option Niche? Iterator + Map - How do divide every element, including the last element, by the last element Why can't we store returned value of a function in a variable if one of the parameters goes out of scope My first crate :D, floop: A more convenient and less error prone replacement for loop `{ select! { .. }}` Sorting is slow because architectures are wrong — zan-sort redesigns the architecture, not the algorithm Iced Font - Create a custom monospace font to display dollar amounts Is the UnsafePinned RFC wrong about being able to return `&mut T` from `get_mut_unchecked`? Fixing Polars 0.37 compilation errors: Hashbrown 0.17 dependency conflict and decimal parsing Any plans for improving error diagnostic in Rust 2.0? How do I build completely offline? Is `&mut T -> &mut ManuallyDrop<T>` well-defined and sound? Would you use this? — fixtura, declarative fake data injection for tests Foreign trait restrictions on native types make generics hard to use Cargo Exclude Directive Compiler reasoning around a modulo counter Multiple mutable references to elements within one vector Handling non-`Send` data in a `Send` closure Review: Static Multi Pool Allocator Rmquickjs - High-level MicroQuickJS bindings for Rust
Whyhttp - HTTP mocks that fail where the bug actually is
@nerjs Alex · 2026-04-22 · via The Rust Programming Language Forum - Latest posts

1

I just put a small crate whyhttp

Yeah, another one. I wrote it for an internal project. My checklist:

  • real HTTP server, no in-process mocking
  • works from sync and async tests
  • an API that reads like the test itself
  • guaranteed assert on drop (can't forget)
  • separate "which mock handles this" from "what should the request look like"

Out of what I tried, httptest came closest - most of what I wanted was
already there. What started to hurt at scale was readability: matchers do
double duty (routing and asserting), all crammed into one all_of![...].
Hard to tell "this picks the mock" from "this validates the field".

whyhttp splits those two:

let server = whyhttp::Whyhttp::run();

server
    .when().path("/orders").method("POST")    // routing
    .should().body(r#"{"qty":1}"#)             // validation, doesn't affect routing
    .response().status(201);

If the body is wrong, the request still routes here, still gets 201, and
the test panics on drop with "expected body X, got Y". You see what was
wrong with the request, not "response parser failed" five frames later.

What it doesn't have: regex, partial JSON, custom predicates, dynamic
responses. Not because they're hard. I just don't want to pick an API
shape without a real use case. Plenty of time to break the API later;
no reason to rush the first cut.

If httptest or wiremock already cover your case, stick with them. If
you hit one where a matcher I don't have would help, open an issue --
that's what I need before picking a shape.

The API is stable; feedback welcome.