Class FromRequest
- java.lang.Object
-
- org.springframework.cloud.contract.spec.internal.FromRequest
-
public class FromRequest extends Object
Helper class to reference the request body parameters.- Since:
- 1.1.0
- Author:
- Marcin Grzejszczak
-
-
Constructor Summary
Constructors Constructor Description FromRequest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DslPropertybody()Request body text (avoid for non-text bodies).DslPropertybody(String jsonPath)Request body text for the given JsonPath.DslPropertycookie(String key)Retruns the tempalte for retrieving the first value of a cookie with certain key.DslPropertyheader(String key)First value of a request header e.g.DslPropertyheader(String key, int index)nth value of a request header (zero indexed) e.g.DslPropertypath()URL path.DslPropertypath(int index)nth value of a URL path (zero indexed) e.g.DslPropertyquery(String key)First value of a query parameter e.g.DslPropertyquery(String key, int index)nth value of a query parameter (zero indexed) e.g.DslPropertyrawBody()Unescaped Request body text (avoid for non-text bodies).DslPropertyrawBody(String jsonPath)Unescaped Request body text for the given JsonPath.DslPropertyrawCookie(String key)Unescaped Returns the template for retrieving the first value of a cookie with certain key.DslPropertyrawHeader(String key)Unescaped First value of a request header e.g.DslPropertyrawHeader(String key, int index)Unescaped nth value of a request header (zero indexed) e.g.DslPropertyrawPath()Unescaped URL path.DslPropertyrawPath(int index)Unescaped nth value of a URL path (zero indexed) e.g.DslPropertyrawQuery(String key)Unescaped First value of a query parameter e.g.DslPropertyrawQuery(String key, int index)Unescaped nth value of a query parameter (zero indexed) e.g.DslPropertyrawUrl()Unescaped URL path and query.DslPropertyurl()
-
-
-
Method Detail
-
url
public DslProperty url()
- Returns:
- URL path and query.
-
query
public DslProperty query(String key)
First value of a query parameter e.g. request.query.search.- Parameters:
key- key for the query param- Returns:
- dsl property
-
query
public DslProperty query(String key, int index)
nth value of a query parameter (zero indexed) e.g. request.query.search.[5].- Parameters:
key- key for the query paramindex- index of the query param- Returns:
- dsl property
-
path
public DslProperty path()
URL path.- Returns:
- dsl property
-
path
public DslProperty path(int index)
nth value of a URL path (zero indexed) e.g. {{{ request.path.[2] }}}* @param index.- Parameters:
index- path index- Returns:
- dsl property
-
header
public DslProperty header(String key)
First value of a request header e.g. request.headers.X-Request-Id.- Parameters:
key- header key- Returns:
- dsl property
-
header
public DslProperty header(String key, int index)
nth value of a request header (zero indexed) e.g. request.headers.X-Request-Id.- Parameters:
key- header keyindex- header index- Returns:
- dsl property
-
cookie
public DslProperty cookie(String key)
Retruns the tempalte for retrieving the first value of a cookie with certain key.- Parameters:
key- cookie key- Returns:
- dsl property
-
body
public DslProperty body()
Request body text (avoid for non-text bodies).- Returns:
- dsl property
-
body
public DslProperty body(String jsonPath)
Request body text for the given JsonPath.- Parameters:
jsonPath- json path body- Returns:
- dsl property
-
rawUrl
public DslProperty rawUrl()
Unescaped URL path and query.- Returns:
- dsl property
-
rawQuery
public DslProperty rawQuery(String key)
Unescaped First value of a query parameter e.g. request.query.search.- Parameters:
key- query key- Returns:
- dsl property
-
rawQuery
public DslProperty rawQuery(String key, int index)
Unescaped nth value of a query parameter (zero indexed) e.g. request.query.search.[5].- Parameters:
key- query keyindex- query index- Returns:
- dsl property
-
rawPath
public DslProperty rawPath()
Unescaped URL path.- Returns:
- dsl property
-
rawPath
public DslProperty rawPath(int index)
Unescaped nth value of a URL path (zero indexed) e.g. {{{ request.path.[2]. }}}*- Parameters:
index- path index- Returns:
- dsl property
-
rawHeader
public DslProperty rawHeader(String key)
Unescaped First value of a request header e.g. request.headers.X-Request-Id.- Parameters:
key- header key- Returns:
- dsl property
-
rawHeader
public DslProperty rawHeader(String key, int index)
Unescaped nth value of a request header (zero indexed) e.g. request.headers.X-Request-Id.- Parameters:
key- header keyindex- header index- Returns:
- dsl property
-
rawCookie
public DslProperty rawCookie(String key)
Unescaped Returns the template for retrieving the first value of a cookie with certain key.- Parameters:
key- cookie key- Returns:
- dsl property
-
rawBody
public DslProperty rawBody()
Unescaped Request body text (avoid for non-text bodies).- Returns:
- dsl property
-
rawBody
public DslProperty rawBody(String jsonPath)
Unescaped Request body text for the given JsonPath.- Parameters:
jsonPath- json path body- Returns:
- dsl property
-
-