Reference documentation and code samples for the Cloud Build V2 API class Google::Api::HttpBody.
Message that represents an arbitrary HTTP body. It should only be used for
payload formats that can't be represented as JSON, such as raw binary or
an HTML page.
This message can be used both in streaming and non-streaming API methods in
the request as well as the response.
It can be used as a top-level request field, which is convenient if one
wants to extract parameters from either the URL or HTTP template into the
request fields and also want access to the raw HTTP body.
Example:
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);
}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Cloud Build V2 API - Class Google::Api::HttpBody (v0.10.0)\n\nVersion latestkeyboard_arrow_down\n\n- [0.10.0 (latest)](/ruby/docs/reference/google-cloud-build-v2/latest/Google-Api-HttpBody)\n- [0.9.1](/ruby/docs/reference/google-cloud-build-v2/0.9.1/Google-Api-HttpBody)\n- [0.8.0](/ruby/docs/reference/google-cloud-build-v2/0.8.0/Google-Api-HttpBody)\n- [0.7.2](/ruby/docs/reference/google-cloud-build-v2/0.7.2/Google-Api-HttpBody)\n- [0.6.0](/ruby/docs/reference/google-cloud-build-v2/0.6.0/Google-Api-HttpBody)\n- [0.5.2](/ruby/docs/reference/google-cloud-build-v2/0.5.2/Google-Api-HttpBody)\n- [0.4.0](/ruby/docs/reference/google-cloud-build-v2/0.4.0/Google-Api-HttpBody)\n- [0.3.0](/ruby/docs/reference/google-cloud-build-v2/0.3.0/Google-Api-HttpBody)\n- [0.2.0](/ruby/docs/reference/google-cloud-build-v2/0.2.0/Google-Api-HttpBody)\n- [0.1.0](/ruby/docs/reference/google-cloud-build-v2/0.1.0/Google-Api-HttpBody) \nReference documentation and code samples for the Cloud Build V2 API class Google::Api::HttpBody.\n\nMessage that represents an arbitrary HTTP body. It should only be used for\npayload formats that can't be represented as JSON, such as raw binary or\nan HTML page.\n\n\nThis message can be used both in streaming and non-streaming API methods in\nthe request as well as the response.\n\nIt can be used as a top-level request field, which is convenient if one\nwants to extract parameters from either the URL or HTTP template into the\nrequest fields and also want access to the raw HTTP body.\n\nExample: \n\n message GetResourceRequest {\n // A unique request id.\n string request_id = 1;\n\n // The raw HTTP body is bound to this field.\n google.api.HttpBody http_body = 2;\n\n }\n\n service ResourceService {\n rpc GetResource(GetResourceRequest)\n returns (google.api.HttpBody);\n rpc UpdateResource(google.api.HttpBody)\n returns (google.protobuf.Empty);\n\n }\n\nExample with streaming methods: \n\n service CaldavService {\n rpc GetCalendar(stream google.api.HttpBody)\n returns (stream google.api.HttpBody);\n rpc UpdateCalendar(stream google.api.HttpBody)\n returns (stream google.api.HttpBody);\n\n }\n\n\u003cbr /\u003e\n\nUse of this type only changes how the request and response bodies are\nhandled, all other features will continue to work unchanged. \n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #content_type\n\n def content_type() -\u003e ::String\n\n**Returns**\n\n- (::String) --- The HTTP Content-Type header value specifying the content type of the body.\n\n### #content_type=\n\n def content_type=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- The HTTP Content-Type header value specifying the content type of the body. \n**Returns**\n\n- (::String) --- The HTTP Content-Type header value specifying the content type of the body.\n\n### #data\n\n def data() -\u003e ::String\n\n**Returns**\n\n- (::String) --- The HTTP request/response body as raw binary.\n\n### #data=\n\n def data=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- The HTTP request/response body as raw binary. \n**Returns**\n\n- (::String) --- The HTTP request/response body as raw binary.\n\n### #extensions\n\n def extensions() -\u003e ::Array\u003c::Google::Protobuf::Any\u003e\n\n**Returns**\n\n- (::Array\\\u003c[::Google::Protobuf::Any](./Google-Protobuf-Any)\\\u003e) --- Application specific response metadata. Must be set in the first response for streaming APIs.\n\n### #extensions=\n\n def extensions=(value) -\u003e ::Array\u003c::Google::Protobuf::Any\u003e\n\n**Parameter**\n\n- **value** (::Array\\\u003c[::Google::Protobuf::Any](./Google-Protobuf-Any)\\\u003e) --- Application specific response metadata. Must be set in the first response for streaming APIs. \n**Returns**\n\n- (::Array\\\u003c[::Google::Protobuf::Any](./Google-Protobuf-Any)\\\u003e) --- Application specific response metadata. Must be set in the first response for streaming APIs."]]