Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ResponsePredicate

A predicate on .

By default, a Vert.x Web Client request ends with an error only if something wrong happens at the network level. In other words, a 404 Not Found response, or a response with the wrong content type, are NOT considered as failures.

[Response predicates] ResponsePredicate can fail a request when the response does not match some criteria.

Custom predicate instances can be used with .

As a convenience, a few predicates for common uses cases are predefined. For example:

  • SC_SUCCESS to verify that the response has a 2xx code, or
  • JSON to verify that the response body contains JSON data.
  • ...
Predefined predicates use the default error converter (discarding the body).

However, you can create a new ResponsePredicate instance from an existing one using {@link ResponsePredicate#create} or {@link ResponsePredicate#create} when the body is required to build the validation failure.

Hierarchy

  • ResponsePredicate

Index

Properties

Static Readonly JSON

Creates a predicate validating the response content-type is application/json.

Static Readonly SC_ACCEPTED

SC_ACCEPTED: ResponsePredicate

202 Accepted

Static Readonly SC_BAD_GATEWAY

SC_BAD_GATEWAY: ResponsePredicate

502 Bad Gateway

Static Readonly SC_BAD_REQUEST

SC_BAD_REQUEST: ResponsePredicate

400 Bad Request

Static Readonly SC_CLIENT_ERRORS

SC_CLIENT_ERRORS: ResponsePredicate

Any 4XX client error

Static Readonly SC_CONFLICT

SC_CONFLICT: ResponsePredicate

409 Conflict

Static Readonly SC_CONTINUE

SC_CONTINUE: ResponsePredicate

100 Continue

Static Readonly SC_CREATED

SC_CREATED: ResponsePredicate

201 Created

Static Readonly SC_EARLY_HINTS

SC_EARLY_HINTS: ResponsePredicate

103 Early Hints

Static Readonly SC_EXPECTATION_FAILED

SC_EXPECTATION_FAILED: ResponsePredicate

417 Expectation Failed

Static Readonly SC_FAILED_DEPENDENCY

SC_FAILED_DEPENDENCY: ResponsePredicate

424 Failed Dependency (WebDAV, RFC4918)

Static Readonly SC_FORBIDDEN

SC_FORBIDDEN: ResponsePredicate

403 Forbidden

Static Readonly SC_FOUND

302 Found

Static Readonly SC_GATEWAY_TIMEOUT

SC_GATEWAY_TIMEOUT: ResponsePredicate

504 Gateway Timeout

Static Readonly SC_GONE

410 Gone

Static Readonly SC_HTTP_VERSION_NOT_SUPPORTED

SC_HTTP_VERSION_NOT_SUPPORTED: ResponsePredicate

505 HTTP Version Not Supported

Static Readonly SC_INFORMATIONAL_RESPONSE

SC_INFORMATIONAL_RESPONSE: ResponsePredicate

Any 1XX informational response

Static Readonly SC_INSUFFICIENT_STORAGE

SC_INSUFFICIENT_STORAGE: ResponsePredicate

507 Insufficient Storage (WebDAV, RFC4918)

Static Readonly SC_INTERNAL_SERVER_ERROR

SC_INTERNAL_SERVER_ERROR: ResponsePredicate

500 Internal Server Error

Static Readonly SC_LENGTH_REQUIRED

SC_LENGTH_REQUIRED: ResponsePredicate

411 Length Required

Static Readonly SC_LOCKED

423 Locked (WebDAV, RFC4918)

Static Readonly SC_METHOD_NOT_ALLOWED

SC_METHOD_NOT_ALLOWED: ResponsePredicate

405 Method Not Allowed

Static Readonly SC_MISDIRECTED_REQUEST

SC_MISDIRECTED_REQUEST: ResponsePredicate

421 Misdirected Request

Static Readonly SC_MOVED_PERMANENTLY

SC_MOVED_PERMANENTLY: ResponsePredicate

301 Moved Permanently

Static Readonly SC_MULTIPLE_CHOICES

SC_MULTIPLE_CHOICES: ResponsePredicate

300 Multiple Choices

Static Readonly SC_MULTI_STATUS

SC_MULTI_STATUS: ResponsePredicate

207 Multi-Status (WebDAV, RFC2518)

Static Readonly SC_NETWORK_AUTHENTICATION_REQUIRED

SC_NETWORK_AUTHENTICATION_REQUIRED: ResponsePredicate

511 Network Authentication Required (RFC6585)

Static Readonly SC_NON_AUTHORITATIVE_INFORMATION

SC_NON_AUTHORITATIVE_INFORMATION: ResponsePredicate

203 Non-Authoritative Information (since HTTP/1.1)

Static Readonly SC_NOT_ACCEPTABLE

SC_NOT_ACCEPTABLE: ResponsePredicate

406 Not Acceptable

Static Readonly SC_NOT_EXTENDED

SC_NOT_EXTENDED: ResponsePredicate

510 Not Extended (RFC2774)

Static Readonly SC_NOT_FOUND

SC_NOT_FOUND: ResponsePredicate

404 Not Found

Static Readonly SC_NOT_IMPLEMENTED

SC_NOT_IMPLEMENTED: ResponsePredicate

501 Not Implemented

Static Readonly SC_NOT_MODIFIED

SC_NOT_MODIFIED: ResponsePredicate

304 Not Modified

Static Readonly SC_NO_CONTENT

SC_NO_CONTENT: ResponsePredicate

204 No Content

Static Readonly SC_OK

200 OK

Static Readonly SC_PARTIAL_CONTENT

SC_PARTIAL_CONTENT: ResponsePredicate

206 Partial Content

Static Readonly SC_PAYMENT_REQUIRED

SC_PAYMENT_REQUIRED: ResponsePredicate

402 Payment Required

Static Readonly SC_PERMANENT_REDIRECT

SC_PERMANENT_REDIRECT: ResponsePredicate

308 Permanent Redirect (RFC7538)

Static Readonly SC_PRECONDITION_FAILED

SC_PRECONDITION_FAILED: ResponsePredicate

412 Precondition Failed

Static Readonly SC_PRECONDITION_REQUIRED

SC_PRECONDITION_REQUIRED: ResponsePredicate

428 Precondition Required (RFC6585)

Static Readonly SC_PROCESSING

SC_PROCESSING: ResponsePredicate

102 Processing (WebDAV, RFC2518)

Static Readonly SC_PROXY_AUTHENTICATION_REQUIRED

SC_PROXY_AUTHENTICATION_REQUIRED: ResponsePredicate

407 Proxy Authentication Required

Static Readonly SC_REDIRECTION

SC_REDIRECTION: ResponsePredicate

Any 3XX redirection

Static Readonly SC_REQUESTED_RANGE_NOT_SATISFIABLE

SC_REQUESTED_RANGE_NOT_SATISFIABLE: ResponsePredicate

416 Requested Range Not Satisfiable

Static Readonly SC_REQUEST_ENTITY_TOO_LARGE

SC_REQUEST_ENTITY_TOO_LARGE: ResponsePredicate

413 Request Entity Too Large

Static Readonly SC_REQUEST_HEADER_FIELDS_TOO_LARGE

SC_REQUEST_HEADER_FIELDS_TOO_LARGE: ResponsePredicate

431 Request Header Fields Too Large (RFC6585)

Static Readonly SC_REQUEST_TIMEOUT

SC_REQUEST_TIMEOUT: ResponsePredicate

408 Request Timeout

Static Readonly SC_REQUEST_URI_TOO_LONG

SC_REQUEST_URI_TOO_LONG: ResponsePredicate

414 Request-URI Too Long

Static Readonly SC_RESET_CONTENT

SC_RESET_CONTENT: ResponsePredicate

205 Reset Content

Static Readonly SC_SEE_OTHER

SC_SEE_OTHER: ResponsePredicate

303 See Other (since HTTP/1.1)

Static Readonly SC_SERVER_ERRORS

SC_SERVER_ERRORS: ResponsePredicate

Any 5XX server error

Static Readonly SC_SERVICE_UNAVAILABLE

SC_SERVICE_UNAVAILABLE: ResponsePredicate

503 Service Unavailable

Static Readonly SC_SUCCESS

SC_SUCCESS: ResponsePredicate

Any 2XX success

Static Readonly SC_SWITCHING_PROTOCOLS

SC_SWITCHING_PROTOCOLS: ResponsePredicate

101 Switching Protocols

Static Readonly SC_TEMPORARY_REDIRECT

SC_TEMPORARY_REDIRECT: ResponsePredicate

307 Temporary Redirect (since HTTP/1.1)

Static Readonly SC_TOO_MANY_REQUESTS

SC_TOO_MANY_REQUESTS: ResponsePredicate

429 Too Many Requests (RFC6585)

Static Readonly SC_UNAUTHORIZED

SC_UNAUTHORIZED: ResponsePredicate

401 Unauthorized

Static Readonly SC_UNORDERED_COLLECTION

SC_UNORDERED_COLLECTION: ResponsePredicate

425 Unordered Collection (WebDAV, RFC3648)

Static Readonly SC_UNPROCESSABLE_ENTITY

SC_UNPROCESSABLE_ENTITY: ResponsePredicate

422 Unprocessable Entity (WebDAV, RFC4918)

Static Readonly SC_UNSUPPORTED_MEDIA_TYPE

SC_UNSUPPORTED_MEDIA_TYPE: ResponsePredicate

415 Unsupported Media Type

Static Readonly SC_UPGRADE_REQUIRED

SC_UPGRADE_REQUIRED: ResponsePredicate

426 Upgrade Required (RFC2817)

Static Readonly SC_USE_PROXY

SC_USE_PROXY: ResponsePredicate

305 Use Proxy (since HTTP/1.1)

Static Readonly SC_VARIANT_ALSO_NEGOTIATES

SC_VARIANT_ALSO_NEGOTIATES: ResponsePredicate

506 Variant Also Negotiates (RFC2295)

Methods

errorConverter

  • Returns ErrorConverter

Static contentType

  • Creates a predicate validating the response has a content-type header matching the mimeType.

    Parameters

    • mimeType: string

    Returns ResponsePredicate

  • Creates a predicate validating the response has a content-type header matching one of the mimeTypes.

    Parameters

    • mimeTypes: string

    Returns ResponsePredicate

Static create

Static status

  • Creates a predicate asserting that the status response code is equal to statusCode.

    Parameters

    • statusCode: number

    Returns ResponsePredicate

  • Creates a predicate asserting that the status response code is in the [min,max[ range.

    Parameters

    • min: number
    • max: number

    Returns ResponsePredicate

Generated using TypeDoc