{"action":"created","issue":{"url":"https://api.github.com/repos/postmanlabs/postman-app-support/issues/3480","repository_url":"https://api.github.com/repos/postmanlabs/postman-app-support","labels_url":"https://api.github.com/repos/postmanlabs/postman-app-support/issues/3480/labels{/name}","comments_url":"https://api.github.com/repos/postmanlabs/postman-app-support/issues/3480/comments","events_url":"https://api.github.com/repos/postmanlabs/postman-app-support/issues/3480/events","html_url":"https://github.com/postmanlabs/postman-app-support/issues/3480","id":254925361,"number":3480,"title":"How to make postman waiting for pre-request script to be finished before making request?","user":{"login":"sergeidyga","id":23492105,"avatar_url":"https://avatars2.githubusercontent.com/u/23492105?v=4","gravatar_id":"","url":"https://api.github.com/users/sergeidyga","html_url":"https://github.com/sergeidyga","followers_url":"https://api.github.com/users/sergeidyga/followers","following_url":"https://api.github.com/users/sergeidyga/following{/other_user}","gists_url":"https://api.github.com/users/sergeidyga/gists{/gist_id}","starred_url":"https://api.github.com/users/sergeidyga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergeidyga/subscriptions","organizations_url":"https://api.github.com/users/sergeidyga/orgs","repos_url":"https://api.github.com/users/sergeidyga/repos","events_url":"https://api.github.com/users/sergeidyga/events{/privacy}","received_events_url":"https://api.github.com/users/sergeidyga/received_events","type":"User","site_admin":false},"labels":[{"id":426264000,"url":"https://api.github.com/repos/postmanlabs/postman-app-support/labels/needs-investigation","name":"needs-investigation","color":"c2e0c6","default":false},{"id":418650506,"url":"https://api.github.com/repos/postmanlabs/postman-app-support/labels/runtime","name":"runtime","color":"006b75","default":false}],"state":"open","locked":false,"assignee":{"login":"kunagpal","id":7289840,"avatar_url":"https://avatars3.githubusercontent.com/u/7289840?v=4","gravatar_id":"","url":"https://api.github.com/users/kunagpal","html_url":"https://github.com/kunagpal","followers_url":"https://api.github.com/users/kunagpal/followers","following_url":"https://api.github.com/users/kunagpal/following{/other_user}","gists_url":"https://api.github.com/users/kunagpal/gists{/gist_id}","starred_url":"https://api.github.com/users/kunagpal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kunagpal/subscriptions","organizations_url":"https://api.github.com/users/kunagpal/orgs","repos_url":"https://api.github.com/users/kunagpal/repos","events_url":"https://api.github.com/users/kunagpal/events{/privacy}","received_events_url":"https://api.github.com/users/kunagpal/received_events","type":"User","site_admin":false},"assignees":[{"login":"kunagpal","id":7289840,"avatar_url":"https://avatars3.githubusercontent.com/u/7289840?v=4","gravatar_id":"","url":"https://api.github.com/users/kunagpal","html_url":"https://github.com/kunagpal","followers_url":"https://api.github.com/users/kunagpal/followers","following_url":"https://api.github.com/users/kunagpal/following{/other_user}","gists_url":"https://api.github.com/users/kunagpal/gists{/gist_id}","starred_url":"https://api.github.com/users/kunagpal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kunagpal/subscriptions","organizations_url":"https://api.github.com/users/kunagpal/orgs","repos_url":"https://api.github.com/users/kunagpal/repos","events_url":"https://api.github.com/users/kunagpal/events{/privacy}","received_events_url":"https://api.github.com/users/kunagpal/received_events","type":"User","site_admin":false}],"milestone":null,"comments":8,"created_at":"2017-09-04T03:11:51Z","updated_at":"2017-10-05T12:45:18Z","closed_at":null,"author_association":"NONE","body":"## App Details:\r\n```\r\nPostman for Chrome\r\nVersion 5.2.0\r\nwin / x86-64\r\nChrome 60.0.3112.113\r\n```\r\n\r\n## Issue Report:\r\nI'm making want to make request with Environment Variable in url. In pre-request script I'm calculating and setting value for my Environment Variable. Here is the code:\r\n```\r\n// Getting js file with script to calculate sha256 hex:\r\neval(postman.getGlobalVariable(\"module:sha256\"));\r\n// Calculating hex for '123':\r\nvar result_hash = sha256('123');\r\n// Setting env. variable:\r\npostman.setEnvironmentVariable(\"result_hash\", result_hash);\r\n```\r\nThen I make request like \"my_url/{{result_hash}}\".\r\n\r\nThe **problem is** that the request is executed **before** then Environment Variable was set: *\"my_url/\"*\r\nSo as a result - it fails. But next consequent absolutely equal request will be successful:\r\n*\"my_url/a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3\"*\r\n\r\n## Question:\r\nHow can I make postman waiting for Environment Variable to be filled (or equal to some value) before executing request? \r\n"},"comment":{"url":"https://api.github.com/repos/postmanlabs/postman-app-support/issues/comments/334453558","html_url":"https://github.com/postmanlabs/postman-app-support/issues/3480#issuecomment-334453558","issue_url":"https://api.github.com/repos/postmanlabs/postman-app-support/issues/3480","id":334453558,"user":{"login":"akutruff","id":874049,"avatar_url":"https://avatars3.githubusercontent.com/u/874049?v=4","gravatar_id":"","url":"https://api.github.com/users/akutruff","html_url":"https://github.com/akutruff","followers_url":"https://api.github.com/users/akutruff/followers","following_url":"https://api.github.com/users/akutruff/following{/other_user}","gists_url":"https://api.github.com/users/akutruff/gists{/gist_id}","starred_url":"https://api.github.com/users/akutruff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akutruff/subscriptions","organizations_url":"https://api.github.com/users/akutruff/orgs","repos_url":"https://api.github.com/users/akutruff/repos","events_url":"https://api.github.com/users/akutruff/events{/privacy}","received_events_url":"https://api.github.com/users/akutruff/received_events","type":"User","site_admin":false},"created_at":"2017-10-05T12:45:18Z","updated_at":"2017-10-05T12:45:18Z","author_association":"NONE","body":"@kamalaknn I'm having trouble reproducing this, but we switched our auth servers which return almost instantly.  It seems that this is an issue in other cases per @rygood.  The above example was the case where I was seeing async issues.  \r\n\r\nAlso, this blog post adds confusion to the issue:  \r\nhttp://blog.getpostman.com/2017/10/03/send-asynchronous-requests-with-postmans-pm-api/ \r\n\r\nThat post makes it sound like the expected behavior is to not have the request wait.  \r\n\r\nIf, ultimately, Postman is going to wait for all sendRequests to complete before moving on to the main request, that makes the most sense.  However, if there is presently an issue I'd like to know.\r\n\r\nOn that note, if the callback for a sendRequest also makes sendRequest will that also be assured to complete prior to the main request?  (I have not tried this use case, but it may be coming in the future.)"}}
{"actor":{"display_login":"akutruff"}}