HttpRequest
Matches any HTTP Request with the provided properties.
- Typescript
- Java
import { matchers } from '@contract-case/case-definition-dsl'
new matchers.http.HttpRequest(requestExample: HttpRequestExample)
Parameters
Name | Type | Description |
---|---|---|
requestExample | matchers.HttpRequestExample | An HttpResponseExample that describes the response. |
import io.contract_testing.contractcase.definitions.matchers.http.HttpRequest;
HttpRequest.Builder.create()
.method(java.lang.Object)
.path(java.lang.Object)
// .body(java.lang.Object)
// .headers(java.lang.Object)
// .query(java.lang.Object)
// .uniqueName(java.lang.String)
.build();
Parameters
Name | Type | Description |
---|---|---|
method | java.lang.Object | A string or string matcher that matches the method used for this example (eg "GET" or "POST" ).Case insensitive. Note that DELETE, GET and HEAD requests should not have bodies - see the HTTP RFCs for details. |
path | java.lang.Object | A string or string matcher that matches the path of this example. Note that any query parameters must be in the query, not in the path. |
body | java.lang.Object | A test equivalence matcher or json object that describes the body for this response. If not provided, no body matching is performed. |
headers | java.lang.Object | A Map of header names and associated test-equivalence matcher values accepted by this example. If not provided, no header matching is performed |
query | java.lang.Object | A test-equivalence matcher for the query. Usually this is a Map of test-equivalence matchers to match the parsed query string, keyed by parameter name. Repeated parameters are collated and put in an array in this map. |
uniqueName | java.lang.String | What unique name, if any, to give to this request. |