Diese Nachricht repräsentiert einen beliebigen HTTP-Hauptteil. Sie sollte nur für Payload-Formate verwendet werden, die nicht als JSON dargestellt werden können, z. B. binäre Rohdaten oder eine HTML-Seite.
Diese Nachricht kann sowohl für Streaming- als auch Nicht-Streaming-API-Methoden in der Anfrage sowie in der Antwort verwendet werden.
Diese Nachricht kann als übergeordnetes Anfragefeld verwendet werden. Das ist praktisch, wenn du Parameter aus der URL- oder HTTP-Vorlage in die Anfragefelder extrahierst und auch auf die Rohdaten des HTTP-Hauptteils zugreifen möchtest.
Beispiel:
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);
}
Durch die Verwendung dieses Typs wird nur die Art und Weise geändert, wie der Anfrage- und Antwort-Nachrichtenkörper gehandhabt wird. Alle anderen Funktionen bleiben unverändert.
Felder
content_type
string
Der HTTP Content-Type-Headerwert, der den Inhaltstyp des Textes angibt.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2024-09-07 (UTC)."],[[["`HttpBody` is a message type used to represent arbitrary HTTP request or response bodies, especially for non-JSON formats like raw binary or HTML."],["It can be used with both streaming and non-streaming API methods, enabling flexibility in data transmission."],["`HttpBody` allows developers to access raw HTTP data while still using structured fields for other request parameters."],["It includes fields for specifying the content type (`content_type`), raw data (`data`), and any application-specific metadata (`extensions`)."]]],["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"]]