Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2011-2024 GatlingCorp (https://gatling.io)
*
* 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
*
* http://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.gatling.javaapi.http;
import static io.gatling.javaapi.core.internal.Converters.*;
import static io.gatling.javaapi.core.internal.Expressions.*;
import edu.umd.cs.findbugs.annotations.NonNull;
import io.gatling.http.client.Request;
import io.gatling.javaapi.core.ActionBuilder;
import io.gatling.javaapi.core.Session;
import io.gatling.javaapi.http.internal.SignatureCalculators;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Function;
/**
* Base DSL for HTTP, WebSocket and SSE requests
*
* @param the type of Java request builder
* @param the type of wrapped Scala request builder
*/
public abstract class RequestActionBuilder<
T extends RequestActionBuilder,
W extends io.gatling.http.request.builder.RequestBuilder>
implements ActionBuilder {
final W wrapped;
RequestActionBuilder(W wrapped) {
this.wrapped = wrapped;
}
protected abstract T make(Function f);
/**
* Set some query parameter
*
* @param name the name of the parameter, expressed as a Gatling Expression Language String
* @param value the value of the parameter, expressed as a Gatling Expression Language String
* @return a new DSL instance
*/
@NonNull
public T queryParam(@NonNull String name, @NonNull String value) {
return make(wrapped -> wrapped.queryParam(toStringExpression(name), toAnyExpression(value)));
}
/**
* Set some query parameter
*
* @param name the name of the parameter, expressed as a function
* @param value the value of the parameter, expressed as a Gatling Expression Language String
* @return a new DSL instance
*/
@NonNull
public T queryParam(@NonNull Function name, @NonNull String value) {
return make(
wrapped -> wrapped.queryParam(javaFunctionToExpression(name), toAnyExpression(value)));
}
/**
* Set some query parameter
*
* @param name the name of the parameter, expressed as a Gatling Expression Language String
* @param value the static value of the parameter
* @return a new DSL instance
*/
@NonNull
public T queryParam(@NonNull String name, @NonNull Object value) {
return make(
wrapped -> wrapped.queryParam(toStringExpression(name), toStaticValueExpression(value)));
}
/**
* Set some query parameter
*
* @param name the name of the parameter, expressed as a function
* @param value the static value of the parameter
* @return a new DSL instance
*/
@NonNull
public T queryParam(@NonNull Function name, @NonNull Object value) {
return make(
wrapped ->
wrapped.queryParam(javaFunctionToExpression(name), toStaticValueExpression(value)));
}
/**
* Set some query parameter
*
* @param name the name of the parameter, expressed as a Gatling Expression Language String
* @param value the value of the parameter, expressed as a function
* @return a new DSL instance
*/
@NonNull
public T queryParam(@NonNull String name, @NonNull Function value) {
return make(
wrapped -> wrapped.queryParam(toStringExpression(name), javaFunctionToExpression(value)));
}
/**
* Set some query parameter
*
* @param name the name of the parameter, expressed as a function
* @param value the value of the parameter, expressed as a function
* @return a new DSL instance
*/
@NonNull
public T queryParam(
@NonNull Function name, @NonNull Function value) {
return make(
wrapped ->
wrapped.queryParam(javaFunctionToExpression(name), javaFunctionToExpression(value)));
}
/**
* Set a multivalued query parameter
*
* @param name the name of the parameter, expressed as a Gatling Expression Language String
* @param values the static list of values of the parameter
* @return a new DSL instance
*/
@NonNull
public T multivaluedQueryParam(@NonNull String name, @NonNull List