Other Commands

Converting the Content

Diggernaut can work with many types of documents: HTML, XML, JSON, JS, iCal, images. But in order to work with different types of data presentation using same approach, diggernaut automatically convert any content to XML and uses special preset of converters based on document Content-type.

However, in some cases, the server can return wrong Content-type, for example, it can send data in JSON format as text/html. The automatic converter in this case will not be able to convert the document properly. In such cases you can use special commands for manual override of converters usage. You can set the conversion mode for a specific Content-type using the set_converter command or remove conversion mode for a specific document type using the clear_converter command.

There are following parameters are used in these commands:

Parameter Description
content_type Content-type of the document for which you want to set or remove converter.
converter Used converter, at this moment following are supported: js, json, ical, image, xml.

Usage examples:

          # SET `json` FOR CONTENT-TYPE `text/html`
- set_converter:
    content_type: text/html
    converter: json
          
          # REMOVE ANY CONVERTER FOR CONTENT-TYPE `text/html`
- clear_converter:
    content_type: text/html
          

In the next chapter, you will learn how to artificially make pauses of arbitrary duration between requests.