پیامی که یک بدنه HTTP دلخواه را نشان میدهد. فقط باید برای قالبهای باری استفاده شود که نمیتوانند بهعنوان JSON نشان داده شوند، مانند باینری خام یا صفحه HTML.
این پیام را می توان هم در روش های پخش جریانی و هم در روش های غیر استریم API در درخواست و همچنین پاسخ استفاده کرد.
می توان از آن به عنوان یک فیلد درخواست سطح بالا استفاده کرد، که اگر بخواهید پارامترهایی را از URL یا الگوی HTTP در فیلدهای درخواست استخراج کنید و همچنین بخواهید به بدنه HTTP خام دسترسی داشته باشید، راحت است.
مثال:
message GetResourceRequest {
// A unique request id.
string request_id = 1;
// The raw HTTP body is bound to this field.
google.api.HttpBody http_body = 2;
}
service ResourceService {
rpc GetResource(GetResourceRequest)
returns (google.api.HttpBody);
rpc UpdateResource(google.api.HttpBody)
returns (google.protobuf.Empty);
}
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[],["The `HttpBody` message represents arbitrary HTTP bodies, useful for non-JSON formats like raw binary or HTML. It's applicable in both streaming and non-streaming API methods for requests and responses. It can serve as a top-level request field, allowing parameter extraction from URLs or HTTP templates alongside access to the raw body. Key components are: `content_type` (specifying the body's type), `data` (raw binary content), and `extensions` (metadata). Its usage alters request/response body handling while preserving other functionalities.\n"]]