Package io.hyperfoil.http.steps
Class BodyBuilder
- java.lang.Object
-
- io.hyperfoil.http.steps.BodyBuilder
-
public class BodyBuilder extends java.lang.ObjectAllows building HTTP request body from session variables.
-
-
Constructor Summary
Constructors Constructor Description BodyBuilder(HttpRequestStepBuilder parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpRequestStepBuilderendBody()FormGenerator.Builderform()Build form as if we were sending the request using HTML form.BodyBuilderfromFile(java.lang.String path)Send contents of the file.BodyBuilderfromVar(java.lang.String var)Use variable content as request body.BodyBuilderpattern(java.lang.String pattern)Pattern replacing${sessionvar}with variable contents in a string.BodyBuildertext(java.lang.String text)String sent as-is.
-
-
-
Constructor Detail
-
BodyBuilder
public BodyBuilder(HttpRequestStepBuilder parent)
-
-
Method Detail
-
fromVar
public BodyBuilder fromVar(java.lang.String var)
Use variable content as request body.- Parameters:
var- Variable name.- Returns:
- Self.
-
pattern
public BodyBuilder pattern(java.lang.String pattern)
Pattern replacing${sessionvar}with variable contents in a string.- Parameters:
pattern- Pattern.- Returns:
- Self.
-
text
public BodyBuilder text(java.lang.String text)
String sent as-is.- Parameters:
text- String.- Returns:
- Self.
-
form
public FormGenerator.Builder form()
Build form as if we were sending the request using HTML form. This option automatically addsContent-Type: application/x-www-form-urlencodedto the request headers.- Returns:
- Builder.
-
fromFile
public BodyBuilder fromFile(java.lang.String path)
Send contents of the file. Note that this method does NOT set content-type automatically.- Parameters:
path- Path to loaded file.- Returns:
- Self.
-
endBody
public HttpRequestStepBuilder endBody()
-
-