'use strict';

const HTTPSnippet = require('httpsnippet');
const harGenerator = require('./harGenerator');

function generate(target, client, data) {
    try {
        const request = harGenerator.generate(data);
        const snippet = new HTTPSnippet(request);
        return snippet.convert(target, client) || '';
    }
    catch (ex) {
        console.warn('Error generating code sample using httpsnippet for', target, client);
        return '';
    }
}

module.exports = {
    generate
};

@@ -421,24 +421,84 @@
 t, client);%0A
+        if (data.options.verbose) console.warn(ex.message);%0A
         retu

httpsnippetGenerator; show exceptions if verbose is true