RestFixtureFitTests.OverrideContentHandlers

Included page: .RestFixtureFitTests.SetUp (edit)

Action Fixture
start smartrics.rest.test.fitnesse.fixture.HttpServerFixture
check is started true
press reset resources database


Overriding content handlers


.RestFixture uses three content handlers to parse and set expectations used to verify the behaviour of HTTP calls.
These are the handlers currently available:

These are the defaults


Note: unrecognised content types.

Content types not recogised will be mapped to the default content handler (XML).

For example, XML handler is used for for content types of application/xml; hence XPaths can be used to set expectations:

Fit Rest Fixture http://localhost:7654
GET /resources/0 200 Content-Type : application/xml;.+
 /resource/name[text()='a funky name'] <br/>
 /resource/data[text()='an important message']

Bespoke mapping can be defined in the config using the config key restfixture.content.handlers.map

smartrics.rest.fitnesse.fixture.RestFixtureConfig overridesContentHandlerConfig
restfixture.content.handlers.map application/xml=TEXT

Fit Rest Fixture http://localhost:7654 overridesContentHandlerConfig
GET /resources/0 200 Content-Type : application/xml;.+ <resource>[\s.]*<name>a funky name</name>[\s\w\d<>/=\:'.]*</resource>[\s]*