Uses of Class
org.mockserver.model.Body

Packages that use Body
org.mockserver.client.serialization.model   
org.mockserver.model   
 

Uses of Body in org.mockserver.client.serialization.model
 

Methods in org.mockserver.client.serialization.model that return Body
abstract  Body BodyDTO.buildObject()
           
 

Methods in org.mockserver.client.serialization.model with parameters of type Body
static BodyDTO BodyDTO.createDTO(Body body)
           
 

Uses of Body in org.mockserver.model
 

Subclasses of Body in org.mockserver.model
 class BinaryBody
           
 class JsonBody
           
 class JsonSchemaBody
           
 class ParameterBody
           
 class RegexBody
           
 class StringBody
           
 class XmlBody
           
 class XPathBody
           
 

Methods in org.mockserver.model that return Body
 Body HttpResponse.getBody()
           
 Body HttpRequest.getBody()
           
 

Methods in org.mockserver.model with parameters of type Body
 HttpResponse HttpResponse.withBody(Body body)
          Set the body to return for example:

string body: - exact("

a simple string body
");

or

- new StringBody("

a simple string body
")

binary body: - binary(IOUtils.readFully(getClass().getClassLoader().getResourceAsStream("example.pdf"), 1024));

or

- new BinaryBody(IOUtils.readFully(getClass().getClassLoader().getResourceAsStream("example.pdf"), 1024));

 HttpRequest HttpRequest.withBody(Body body)
          The body match rules on such as using one of the Body subclasses as follows: exact string match: - exact("this is an exact string body"); or - new StringBody("this is an exact string body") regular expression match: - regex("username[a-z]{4}"); or - new RegexBody("username[a-z]{4}"); json match: - json("{username: 'foo', password: 'bar'}"); or - json("{username: 'foo', password: 'bar'}", MatchType.STRICT); or - new JsonBody("{username: 'foo', password: 'bar'}"); json schema match: - jsonSchema("{type: 'object', properties: { 'username': { 'type': 'string' }, 'password': { 'type': 'string' } }, 'required': ['username', 'password']}"); or - jsonSchemaFromResource("org/mockserver/model/loginSchema.json"); or - new JsonSchemaBody("{type: 'object', properties: { 'username': { 'type': 'string' }, 'password': { 'type': 'string' } }, 'required': ['username', 'password']}"); xpath match: - xpath("/element[key = 'some_key' and value = 'some_value']"); or - new XPathBody("/element[key = 'some_key' and value = 'some_value']"); body parameter match: - params( param("name_one", "value_one_one", "value_one_two") param("name_two", "value_two") ); or - new ParameterBody( new Parameter("name_one", "value_one_one", "value_one_two") new Parameter("name_two", "value_two") ); binary match: - binary(IOUtils.readFully(getClass().getClassLoader().getResourceAsStream("example.pdf"), 1024)); or - new BinaryBody(IOUtils.readFully(getClass().getClassLoader().getResourceAsStream("example.pdf"), 1024)); for more details of the supported regular expression syntax see http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html for more details of the supported json syntax see http://jsonassert.skyscreamer.org for more details of the supported json schema syntax see http://json-schema.org/ for more detail of XPath syntax see http://saxon.sourceforge.net/saxon6.5.3/expressions.html
 



Copyright © 2016. All rights reserved.