Pre-request Scripts in Postman | The Exploratory

Поделиться
HTML-код
  • Опубликовано: 18 янв 2025

Комментарии • 8

  • @sergiu_s
    @sergiu_s 2 года назад +1

    Hi, i’m not sure is this the official postman channel, if so, it’s possible to improve the accessibility of postman for blind users that use the screen reader? Thanks

    • @postman
      @postman  2 года назад +1

      We recommend upvoting this feature request, or chiming in with your specific scenarios (if not already covered): github.com/postmanlabs/postman-app-support/issues/3121

    • @sergiu_s
      @sergiu_s 2 года назад

      @@postman thank you for replying. I noticed that a lot of accessible issues I found in Postman was been mentioned years ago. Do you have more realistic news about these problems? Are they working to fix them? Thanks

  • @siddharthau489
    @siddharthau489 2 года назад

    Thanks for the detailed explanation. Can we write a pre request script to upload an image file as binary in the Body of the request?
    I have an api in which I upload the image binary in the body before sending the request. I'm trying to validate this through script. Could you please guide me how to write the script for this. Thank You.

  • @johnquarto
    @johnquarto 2 года назад

    If I heard you right, the pre-request for the collection will fire before any of the requests in the collection. Thinking of OAuth2, very useful but the API we are required to use is highly rate-limited for the getting of tokens; each is good for 15 minutes. Is there a way to save the token variable so that if I run, say 3 different requests one after the other, it only needs to get one token and can re-use it for the second and third requests, rather than requesting a new token every time?

    • @postman
      @postman  2 года назад

      Yes, you can save the expiry date of the token in a variable and only get a new token when it has expired. We have an example of doing that in this collection, fork it and adapt it to your needs! www.postman.com/postman/workspace/postman-answers/documentation/9215231-2dd82ce4-b940-4797-8fff-662721c77c50?entity=&branch=&version=
      If you have any more questions I'd recommend posting them on the community forum: community.postman.com

  • @SRW27
    @SRW27 Год назад

    Hi, thanks for the explanation on this! I do have one question regarding Pre Request scripts, is there a way to change the Environment with a Pre Request Script? For example if I'm running a folder which is running against Environment "ABC" but one request within that folder I want to run against Environment "DEF" is there code i can put into Post Request Script of that particular request to do that?

    • @postman
      @postman  Год назад

      Hey there! You can't switch environment from the pre-request script, we're tracking it as a feature request here: github.com/postmanlabs/postman-app-support/issues/11055