io.micronaut.function.aws.proxy.test.BodyUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of micronaut-function-aws-api-proxy-test Show documentation
Show all versions of micronaut-function-aws-api-proxy-test Show documentation
Provides integration between Micronaut and Amazon Web Services (AWS)
The newest version!
/*
* Copyright 2017-2023 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.function.aws.proxy.test;
import io.micronaut.core.annotation.Internal;
import io.micronaut.core.annotation.NonNull;
import io.micronaut.http.MediaType;
import io.micronaut.json.JsonMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Optional;
import java.util.function.Supplier;
/**
* Utility class to provide conversion for HTTP request body.
* @author Sergio del Amo
* @since 4.0.0
*/
@Internal
public final class BodyUtils {
private static final Logger LOG = LoggerFactory.getLogger(BodyUtils.class);
private BodyUtils() {
}
@NonNull
public static Optional bodyAsString(@NonNull JsonMapper jsonMapper,
@NonNull Supplier contentTypeSupplier,
@NonNull Supplier characterEncodingSupplier ,
@NonNull Supplier