qubit_http/request/http_request_body.rs
1/*******************************************************************************
2 *
3 * Copyright (c) 2025 - 2026.
4 * Haixing Hu, Qubit Co. Ltd.
5 *
6 * All rights reserved.
7 *
8 ******************************************************************************/
9//! Request body variants.
10
11use bytes::Bytes;
12
13/// Encodes how the outbound body is represented before sending via reqwest.
14#[derive(Debug, Clone, PartialEq, Eq, Default)]
15pub enum HttpRequestBody {
16 /// No body (typical for GET/HEAD).
17 #[default]
18 Empty,
19 /// Opaque binary payload.
20 Bytes(Bytes),
21 /// UTF-8 text; builders may set `Content-Type: text/plain`.
22 Text(String),
23 /// JSON-serialized bytes; builders may set `Content-Type: application/json`.
24 Json(Bytes),
25 /// URL-encoded form bytes; builders may set `Content-Type: application/x-www-form-urlencoded`.
26 Form(Bytes),
27 /// Multipart body bytes; builders may set `Content-Type: multipart/form-data; boundary=...`.
28 Multipart(Bytes),
29 /// NDJSON bytes (`\n`-delimited JSON objects); builders may set `application/x-ndjson`.
30 Ndjson(Bytes),
31}