All Downloads are FREE. Search and download functionalities are using the official Maven repository.

FitNesseRoot.RestFixtureFitTests.OverrideContentHandlers.content.txt Maven / Gradle / Ivy

!3 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:
 * '''XML''' interprets the body as an xml string and allows XPath expressions as expectations on that content
 * '''JSON''' interprets the body as a JSON string and allows expectations to be written in JavaScript.
 * '''TEXT''' interprets the body as a string and allows regular expression expectations.

These are the defaults

 * default=XML
 * application/xml=XML
 * application/json=JSON
 * text/plain=TEXT

!*** 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://${jettyHost}:${jettyPort}|
|GET    | /resources/0 | 200 | Content-Type : application/xml;.+ |!-
 /resource/name[text()='a funky name'] 
/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://${jettyHost}:${jettyPort}| overridesContentHandlerConfig | |GET | /resources/0 | 200 | Content-Type : application/xml;.+ |[\s.]*a funky name[\s\w\d<>/=\:'.]*[\s]*|




© 2015 - 2024 Weber Informatics LLC | Privacy Policy