Hacker News new | ask | show | jobs
by _cenw 1019 days ago
The one piece of Postman that only Hoppscotch (a Postman fork) seems replicate that I definitely want is scripting. Often requests depend upon data from another, and being able to put things into the environment as you run different requests is super useful (even if you just use it for otherwise unsupported auth methods).
2 comments

I didn't quite understand if you are aware, but Postman has scripting and can depend upon data from another. And even can query it serially if you add requests to folder, right click on folder and "Run folder".

Scripting is under Tests tab.

I've built oauth2 authorization flow to get the code and afterwards the access token.

First request Test script:

  pm.expect(pm.response.code).to.equal(302);
  var code = pm.response.body;
  var location = pm.response.headers.get("Location");
  if (location.match(/\\?code=([^&]+)/) === null) {
      postman.setNextRequest(pm.info.requestName)
      console.log("Request must be re-run. First time adfs wants to set some cookies, eh.")
  } else {
      var code = location.match(/\\?code=([^&]+)/)[1];
      pm.environment.set("oauth2_authorizationcode", code);
  }
Second request Test script:

  pm.environment.set("oauth2_accesstoken", pm.response.json().access_token);
  pm.environment.set("oauth2_refreshtoken", pm.response.json().refresh_token);
Scripting: https://learning.postman.com/docs/writing-scripts/script-ref...
That's why parent wrote that Hopscotch is the only solution which replicated Postman scripting.

>The one piece of Postman that only Hoppscotch (a Postman fork) seems replicate that I definitely want is scripting.

Parent is talking about the lack of scripting in Postman alternatives.

Hoppscotch is not a Postman fork as far as I know.

You can do request chaining with Step CI (https://stepci.com) and Hurl (https://hurl.dev)