Skip to content
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 request: support for copying/pasting and editing headers #110

Open
davidfokkema opened this issue Sep 22, 2024 · 3 comments
Open

Comments

@davidfokkema
Copy link
Contributor

One of the services I'm accessing uses OAuth access tokens in the header of requests. Right now, I have to manually enter that access token for every URL I'm testing. That's a bit of a pain since that token cannot be retrieved a second time and since I cannot copy the value from posting directly. I have to use the fiddly mouse select in my terminal. Collection-wide config is very useful here, but copy/pasting of headers would also be great. What's more, whenever my access token expires I have to delete the header and add it back again with the new token. Would be useful if clicking on the header would populate the name and value inputs and when changing those values would change the header. Since you can have multiple headers with the same name, maybe add an "update" button next to "add header" which is disabled whenever the name is unique and there is nothing to update, and thus providing a choice for the user to update the header or add a new one otherwise.

Love posting, ;-)

@darrenburns
Copy link
Owner

I'm working on a pre-request/post-response script feature which might help with this.

You can associate a script with a request, and execute some simple Python code.

So, you could have a simple one liner attached to your "get oauth token" request which sets a variable for the duration of the session. Something like:

def on_response(response, posting):
    posting.variables.my_token = response.json.get("token")

Other requests can then use $my_token.

I do want to add support for copy and pasting headers too though!

@darrenburns
Copy link
Owner

Also think the "update" button is a pretty nice idea too!

@davidfokkema
Copy link
Contributor Author

Great! Adding scripts would be very helpful, then you'll only have to change the token in a single place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants