ValidateStatus201BodyStrategy
public struct ValidateStatus201BodyStrategy : ResponseBodyDecodingStrategy
A strategy for validating response bodies with status code 201.
The ValidateStatus201BodyStrategy struct provides a strategy for validating response bodies
with a status code of 201 (Created). It conforms to the ResponseBodyDecodingStrategy protocol
and defines the allowsEmptyContent(for:) and validate(statusCode:) methods.
Example usage:
@ResponseBodyWrapper<Body, ValidateStatus201BodyStrategy> var body: Body
-
Indicates whether empty content is allowed for the given status code.
This method always returns
falsefor status code 201, indicating that empty content is not allowed.Declaration
Swift
public static func allowsEmptyContent(for statusCode: Int) -> BoolParameters
statusCodeThe HTTP status code of the response.
Return Value
A Boolean value indicating whether empty content is allowed.
-
Validates the HTTP status code to determine if it is 201 (Created).
Example usage:
let isValid = ValidateStatus201BodyStrategy.validate(statusCode: 201) print(isValid) // Output: trueDeclaration
Swift
public static func validate(statusCode: Int) -> BoolParameters
statusCodeThe HTTP status code of the response.
Return Value
A Boolean value indicating whether the status code is 201 (Created).
View on GitHub