The new DHC version 1.2.10 supports HTTP Archive (HAR). You can import HAR directly to DHC and start testing your API endpoints in a second, now! This article shows you how it works, and how easily you can do that.
HAR is a common format for recording HTTP tracking information. HAR format is flexible enough and is adopted across projects and various tools. E.g. You can easily export intercepted HTTP communication as HAR file with Chrome DevTools.
DHC has a concept of a repository, a place where to store your scenarios, tests, or just plain HTTP requests/responses. You can put a content to a repository manually by click on a save button. Moreover, you can import an existing content made by your teammates, or produced by 3rd party software.
DHC version 1.2.10 supports three formats to import:
- HTTP Archive v1.2 (HAR)
- Swagger version 2.0
- ‘native’ DHC format (v1.3) which is based on JSON – please see DHC help, section import/export for details
How to import HAR to DHC?
When DHC is launched you should see something similar to the screenshot below.
Please click on the repository import button and select ‘Import HAR 1.2’ format. It opens a dialog where you can select a source of HAR. You may choose between a plain file stored on your disk (‘File’), or to import HAR from an URL (‘URL’), or just to copy and paste HAR as a plain text (‘Raw text’).
DHC HAR import dialog
I will import HAR from a locally stored file that was made with using of Chrome DevTools. For a demonstration it just contains a track of HTTP communication performed by a browser when opening Restlet home page.
Creation of XHR with using of Chrome DevTools
When you do import HAR into DHC all HTTP requests stored in the archive are shown in DHC repository. You just click on one and everything is ready to start playing!
XHR imported into DHC
Don’t forget you can easily turn plain requests into unit tests by adding assertions and that you can also create complex scenarios based on it.
Please note HAR support is still in a preview. Feel free to contact support in case you run into any issue or if you get stuck on something.