1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! SZ-Rust HTTP Facade
//!
//! 提取自 `sz-rust-core` 的 HTTP 基础模块,提供响应、错误、请求三大基础能力。
//!
//! ## 模块结构
//!
//! | 模块 | 对齐 PHP | 说明 |
//! |------|---------|------|
//! | [`response`] | `SzController::renderJson/renderSuccess/renderError` | 标准 API 响应结构 + 便捷函数 |
//! | [`error`] | `app\common\exception\BaseException` | 错误码枚举 + 异常类型 |
//! | [`request`] | `$this->request->post/get/param` | 请求体/查询参数解析 |
//!
//! ## 用法
//!
//! ```ignore
//! use sz_rust_http_facade::response::{ApiResponse, respond_html};
//! use sz_rust_http_facade::error::{BaseException, ErrorCode};
//! use sz_rust_http_facade::request::fetch_post_data;
//! ```
//!
//! ## 与 sz-rust-core 的关系
//!
//! `sz-rust-core` 通过 `pub use sz_rust_http_facade as http;` 重导出本 crate,
//! 因此 `sz_rust_core::http::response` 等价于 `sz_rust_http_facade::response`。
//! 下游业务包推荐直接依赖 `sz-rust-http-facade` 以减少编译耦合。
/// GraphQL 支持(需启用 `graphql` feature)
///
/// 提供 [`graphql_router_dynamic`] / [`graphql::graphql_router`] 构建 GraphQL axum 路由,
/// 以及 [`graphql::graphiql_route`] 提供 GraphiQL IDE。
// ============================================================================
// 便捷重导出 — 顶层直接访问常用项
// ============================================================================
pub use ;
pub use ;