All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zalando.riptide.idempotency.DefaultIdempotencyDetector Maven / Gradle / Ivy

package org.zalando.riptide.idempotency;

import org.apiguardian.api.API;
import org.zalando.riptide.RequestArguments;

import java.util.function.Predicate;

import static org.apiguardian.api.API.Status.EXPERIMENTAL;

/**
 * @see Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content, Section 4.2.1
 * @see Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content, Section 4.2.2
 */
@API(status = EXPERIMENTAL)
public final class DefaultIdempotencyDetector implements IdempotencyDetector {

    @Override
    public boolean test(final RequestArguments arguments, final Predicate root) {
        switch (arguments.getMethod()) {
            case DELETE:
            case GET:
            case HEAD:
            case OPTIONS:
            case PUT:
            case TRACE:
                return true;
            default:
                return false;
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy