Class GoogleMultipartParts
java.lang.Object
io.micronaut.gcp.function.http.GoogleMultipartParts
Builds the
parts of a multipart/form-data request for the request
implementations that do not come from the Functions Framework invoker, which parses them itself.- Since:
- 6.2.0
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescriptionResolves the parts of a request body that has not been encoded, such as theMultipartBodyof a request passed toHttpFunction.invoke(io.micronaut.http.HttpRequest).Parses amultipart/form-databody.
-
Method Details
-
parse
public static Map<String, com.google.cloud.functions.HttpRequest.HttpPart> parse(@Nullable String contentType, byte[] body) Parses amultipart/form-databody. Like the invoker, a request of any other content type has no parts.- Parameters:
contentType- The request content type, including the boundarybody- The complete request body- Returns:
- The parts by name
- Throws:
IllegalStateException- If the content type is notmultipart/form-data
-
fromBody
public static Optional<Map<String, com.google.cloud.functions.HttpRequest.HttpPart>> fromBody(@Nullable Object body) Resolves the parts of a request body that has not been encoded, such as theMultipartBodyof a request passed toHttpFunction.invoke(io.micronaut.http.HttpRequest).- Parameters:
body- The request body- Returns:
- The parts by name, or empty if the body is not a multipart body
-