Komunikat dotyczący dowolnej treści HTTP. Powinien być używany wyłącznie w przypadku formatów ładunku, których nie da się zapisać jako JSON, takich jak pliki binarne RAW lub strony HTML.
Komunikat może być używany w żądaniu oraz w odpowiedzi zarówno w strumieniowych, jak i niestrumieniowych metodach API.
Może służyć jako pole żądania najwyższego poziomu, co jest wygodne, gdy chcesz wyodrębnić parametry z szablonu URL lub HTTP i użyć ich w polach żądania oraz gdy potrzebujesz dostępu do treści HTTP w formacie RAW.
Przykład
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);
}
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 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"]]