{"action":"created","issue":{"url":"https://api.github.com/repos/marcelduran/webpagetest-api/issues/55","labels_url":"https://api.github.com/repos/marcelduran/webpagetest-api/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/marcelduran/webpagetest-api/issues/55/comments","events_url":"https://api.github.com/repos/marcelduran/webpagetest-api/issues/55/events","html_url":"https://github.com/marcelduran/webpagetest-api/issues/55","id":113224850,"number":55,"title":"2nd test run with same options object","user":{"login":"furybyname","id":170194,"avatar_url":"https://avatars.githubusercontent.com/u/170194?v=3","gravatar_id":"","url":"https://api.github.com/users/furybyname","html_url":"https://github.com/furybyname","followers_url":"https://api.github.com/users/furybyname/followers","following_url":"https://api.github.com/users/furybyname/following{/other_user}","gists_url":"https://api.github.com/users/furybyname/gists{/gist_id}","starred_url":"https://api.github.com/users/furybyname/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/furybyname/subscriptions","organizations_url":"https://api.github.com/users/furybyname/orgs","repos_url":"https://api.github.com/users/furybyname/repos","events_url":"https://api.github.com/users/furybyname/events{/privacy}","received_events_url":"https://api.github.com/users/furybyname/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-25T13:07:23Z","updated_at":"2015-10-25T14:06:59Z","closed_at":null,"body":"Using the following code:\r\n```\r\nvar WebPageTest = require('webpagetest');\r\n\r\nvar wpt = new WebPageTest('server', 'key');\r\n\r\nvar options = {\r\n\tpollResults: 5,\r\n\ttimeout: 60\r\n}\r\n\r\nfunction runTest(url) {\r\n\twpt.runTest(url, options, function(err, data) {\r\n\t\trunTest('some-other-url');\r\n\t});\r\n}\r\n\r\nrunTest('some-url');\r\n```\r\nThe options object has been modified after the first test run is complete, meaning for the 2nd run the following is passed:\r\n```\r\n{\r\n pollResults: 5000,\r\n timeout: 60000\r\n}\r\n```\r\n\r\nThis is because of:\r\n```\r\noptions.timeout = (parseInt(options.timeout, 10) || 0) * 1000;\r\nand \r\noptions.pollResults = parseInt(options.pollResults * 1000, 10) || 5000;\r\n\r\n```\r\nThis can be worked around by passing a new object each time but using the same object is fairly common. It would be better if the options object was not modified.\r\n\r\nUse-case is here is gathering data from multiple urls with a single script."},"comment":{"url":"https://api.github.com/repos/marcelduran/webpagetest-api/issues/comments/150926459","html_url":"https://github.com/marcelduran/webpagetest-api/issues/55#issuecomment-150926459","issue_url":"https://api.github.com/repos/marcelduran/webpagetest-api/issues/55","id":150926459,"user":{"login":"furybyname","id":170194,"avatar_url":"https://avatars.githubusercontent.com/u/170194?v=3","gravatar_id":"","url":"https://api.github.com/users/furybyname","html_url":"https://github.com/furybyname","followers_url":"https://api.github.com/users/furybyname/followers","following_url":"https://api.github.com/users/furybyname/following{/other_user}","gists_url":"https://api.github.com/users/furybyname/gists{/gist_id}","starred_url":"https://api.github.com/users/furybyname/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/furybyname/subscriptions","organizations_url":"https://api.github.com/users/furybyname/orgs","repos_url":"https://api.github.com/users/furybyname/repos","events_url":"https://api.github.com/users/furybyname/events{/privacy}","received_events_url":"https://api.github.com/users/furybyname/received_events","type":"User","site_admin":false},"created_at":"2015-10-25T14:06:59Z","updated_at":"2015-10-25T14:06:59Z","body":"Would it be better to clone the whole object, or just created new variables for those modified ones?Cloning would future-proof it a bit more I think."}}