-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/pre request script #231
Conversation
DeepCode Report (#ad1c74)DeepCode analyzed this pull request. |
Hey @nickpalenchar, TravisBuddy Request Identifier: 44aad4c0-fabd-11e9-94bd-fbbf6873bcfd |
Works good!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
Agreed on the post-merge todos! Additionally, we could also indicate this feature is not fully stable as-is. Something as simple as changing the header to |
Hey @nickpalenchar, TravisBuddy Request Identifier: 2c05fc60-fac2-11e9-94bd-fbbf6873bcfd |
fixes #218
scrapped the old branch
feature/dynamic-headers
after merge woes (will delete soon).Lots more to think about, but I feel it satisfies mvp (and would love to get this in master so I can take a break from keeping it up-to-date manually 😅)
Request section has a
code
button. When clicked, it enables pre-request scripts. A pre-request script section appears above where javascript can be entered.pre-request script has access to a postwoman api object (
pw
) that can be interacted with. Right now the only thing to do ispw.environment.set("key", "value")
to set a variable that can be used in areas of the request. Note this is native javascript, so any js method can be used. Final values are all treated as strings.Test by setting something in the pre-request script
pw.environment.set("route", "/api/users");
and replacing parts of the request within double angle brackets (path =<<route>>
). Response should function the same as if the final value was statically typed.Additionally, requests made this way end up in history with the same
code
icon. Hovering over it informs the user that this entry in the history used pre-request scripts. Due to it's highly dynamic potential, you could say that note serves as a warning!tangentially -- @NBTX can you make the request-chaining into its own issue? I realized it's quite separate from this one so it would be good to address that after this.