Package com.robothy.s3.rest.assertions
Class RequestAssertions
java.lang.Object
com.robothy.s3.rest.assertions.RequestAssertions
HTTP requests related assertions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringassertBucketNameProvided(com.robothy.netty.http.HttpRequest request) Assert that the request provided the bucket name in path variable.assertDelimiterIsValid(com.robothy.netty.http.HttpRequest request) Assert that user provided delimiter is a character.assertEncodingTypeIsValid(com.robothy.netty.http.HttpRequest request) Assert the value of encoding-type is "url".static IntegerassertIntegerParameterOrNull(com.robothy.netty.http.HttpRequest request, String queryParam) Assert that the HTTP request doesn't have the parameter, or the parameter is integer.static StringassertObjectKeyProvided(com.robothy.netty.http.HttpRequest request) Assert that the object key in provided in the request.static intassertPartNumberIsValid(com.robothy.netty.http.HttpRequest request) Assert the provided part number is valid.static StringassertUploadIdIsProvided(com.robothy.netty.http.HttpRequest request) Assert that the uploadId is in the query parameters.static StringassertUserMetadataHeaderIsValid(String userMetaHeaderName) Assert that the user-defined metadata header is valid.
-
Constructor Details
-
RequestAssertions
public RequestAssertions()
-
-
Method Details
-
assertBucketNameProvided
Assert that the request provided the bucket name in path variable.- Parameters:
request- HTTP request.- Returns:
- the bucket name.
-
assertObjectKeyProvided
Assert that the object key in provided in the request.- Parameters:
request- HTTP request.- Returns:
- the object key.
-
assertDelimiterIsValid
Assert that user provided delimiter is a character.- Parameters:
request- HTTP request.- Returns:
- fetched character or null.
-
assertEncodingTypeIsValid
public static Optional<String> assertEncodingTypeIsValid(com.robothy.netty.http.HttpRequest request) Assert the value of encoding-type is "url".- Parameters:
request- HTTP request.- Returns:
- fetched encoding type or null.
-
assertPartNumberIsValid
public static int assertPartNumberIsValid(com.robothy.netty.http.HttpRequest request) Assert the provided part number is valid. Between 1~10000.- Parameters:
request- HTTP request.- Returns:
- the fetched part number.
-
assertUploadIdIsProvided
Assert that the uploadId is in the query parameters.- Parameters:
request- HTTP request.- Returns:
- fetched upload ID.
-
assertUserMetadataHeaderIsValid
Assert that the user-defined metadata header is valid.- Parameters:
userMetaHeaderName- the user-defined object metadata header name.- Returns:
- the user-defined object metadata name without "x-amz-meta-" prefix.
-
assertIntegerParameterOrNull
public static Integer assertIntegerParameterOrNull(com.robothy.netty.http.HttpRequest request, String queryParam) Assert that the HTTP request doesn't have the parameter, or the parameter is integer.
-