Class GoogleMultipartParts

java.lang.Object
io.micronaut.gcp.function.http.GoogleMultipartParts

@Internal public final class GoogleMultipartParts extends Object
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 Details

    • parse

      public static Map<String, com.google.cloud.functions.HttpRequest.HttpPart> parse(@Nullable String contentType, byte[] body)
      Parses a multipart/form-data body. Like the invoker, a request of any other content type has no parts.
      Parameters:
      contentType - The request content type, including the boundary
      body - The complete request body
      Returns:
      The parts by name
      Throws:
      IllegalStateException - If the content type is not multipart/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 the MultipartBody of a request passed to HttpFunction.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