Class HttpRequestBodyMultipartBuilder
java.lang.Object
com.github.mjeanroy.junit.servers.client.HttpRequestBodyMultipartBuilder
A builder for
HttpRequestBodyMultipart request.-
Method Summary
Modifier and TypeMethodDescriptionaddFormDataPart(HttpRequestBody body, String name) Add"form-data"part.addFormDataPart(HttpRequestBody body, String name, String filename) Add"form-data"part.addFormDataPart(File file, String name) Add"form-data"part.addFormDataPart(File file, String name, String filename) Add"form-data"part.addFormDataPart(String name, String value) Add"form-data"part.addFormDataPart(Path path, String name) Add"form-data"part.addFormDataPart(Path path, String name, String filename) Add"form-data"part.addPart(HttpRequestBodyPart part) Add part to request body.Update content-type to"multipart/alternative".Update content-type to"multipart/digest".Update content-type to"multipart/form-data".Update content-type to"multipart/mixed".Update content-type to"multipart/parallel".build()Build multipart body.booleaninthashCode()toString()withBoundaries(String boundaries) Define new boundaries value.
-
Method Details
-
withBoundaries
Define new boundaries value.- Parameters:
boundaries- Newboundaries- Returns:
- The builder.
-
addFormDataPart
Add"form-data"part. Instead of a "simple" part, aContent-Dispositionheader will be automatically added with this part, such as:Content-Disposition: form-data; name="<name>".- Parameters:
body- Part body.name- The name attribute ofCOntent-Dispositionheader.- Returns:
- The builder.
-
addFormDataPart
public HttpRequestBodyMultipartBuilder addFormDataPart(HttpRequestBody body, String name, String filename) Add"form-data"part. Instead of a "simple" part, aContent-Dispositionheader will be automatically added with this part, such as:Content-Disposition: form-data; name="<name>".- Parameters:
body- Part body.name- The name attribute ofContent-Dispositionheader.filename- The filename attributeContent-Dispositionheader.- Returns:
- The builder.
-
addFormDataPart
Add"form-data"part. Instead of a "simple" part, aContent-Dispositionheader will be automatically added with this part, such as:Content-Disposition: form-data; name="<name>".- Parameters:
name- The name attribute ofCOntent-Dispositionheader.value- Part raw value.- Returns:
- The builder.
-
addFormDataPart
Add"form-data"part. Instead of a "simple" part, aContent-Dispositionheader will be automatically added with this part, such as:Content-Disposition: form-data; name="<name>"; filename="<filename>". The name of the file in parameter will be automatically used as thefilenameattribute ofContent-Dispositionheader.- Parameters:
file- The file being sent.name- The name attribute ofCOntent-Dispositionheader.- Returns:
- The builder.
-
addFormDataPart
Add"form-data"part. Instead of a "simple" part, aContent-Dispositionheader will be automatically added with this part, such as:Content-Disposition: form-data; name="<name>"; filename="<filename>".- Parameters:
file- The file being sent.name- The name attribute ofCOntent-Dispositionheader.filename- The filename attributeContent-Dispositionheader.- Returns:
- The builder.
-
addFormDataPart
Add"form-data"part. Instead of a "simple" part, aContent-Dispositionheader will be automatically added with this part, such as:Content-Disposition: form-data; name="<name>"; filename="<filename>".- Parameters:
path- The file being sent.name- The name attribute ofCOntent-Dispositionheader.- Returns:
- The builder.
-
addFormDataPart
Add"form-data"part. Instead of a "simple" part, aContent-Dispositionheader will be automatically added with this part, such as:Content-Disposition: form-data; name="<name>"; filename="<filename>".- Parameters:
path- The file being sent.name- The name attribute ofCOntent-Dispositionheader.filename- The filename attributeCOntent-Dispositionheader.- Returns:
- The builder.
-
addPart
Add part to request body.- Parameters:
part- Part to add.- Returns:
- The builder.
-
asMultipartFormData
Update content-type to"multipart/form-data".- Returns:
- The builder.
-
asMultipartMixed
Update content-type to"multipart/mixed".- Returns:
- The builder.
-
asMultipartAlternative
Update content-type to"multipart/alternative".- Returns:
- The builder.
-
asMultipartDigest
Update content-type to"multipart/digest".- Returns:
- The builder.
-
asMultipartParallel
Update content-type to"multipart/parallel".- Returns:
- The builder.
-
build
Build multipart body.- Returns:
- The multipart body.
-
toString
-
equals
-
hashCode
public int hashCode()
-