From 9f670d8fed9178946f520c26954c5524e4683d85 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Thu, 24 Jan 2013 16:07:05 -0500 Subject: [PATCH] #2 - can now add headers as JSON string in configuration file --- Readme.md | 3 +++ lib/index.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Readme.md b/Readme.md index d6a69cf..9c0cddd 100644 --- a/Readme.md +++ b/Readme.md @@ -22,6 +22,8 @@ each property corresponds to specific settings for that given url. The options available for each url are the same as those available to `http.request` (http://nodejs.org/api/http.html#http_http_request_options_callback). +When using the configuration setting `headers` you *must* provide the value as a valid JSON string. + ### Example ```ini [localhost] @@ -31,6 +33,7 @@ num = 5 [localhost/submit] port = 8000 data = this is a test +headers = {"some": "values"} method = post num = 2 diff --git a/lib/index.js b/lib/index.js index 4ade422..bc6e7a4 100644 --- a/lib/index.js +++ b/lib/index.js @@ -104,6 +104,9 @@ var errors = []; var errors_length = 0; var urls = []; for( var key in config.urls ){ + if(config.urls[key]['headers']){ + config.urls[key]['headers'] = JSON.parse(config.urls[key]['headers']); + } var url = config.urls[key]; for( var i = 0; i < url.num; ++i ){ urls.push(url);