![]() ![]() If you have any thoughts on how to to improve this, please let me know. Hope this is helpful to someone else out there who prefers to work in a terminalīut wants a way to modernize their API testing workflow. HTTPie (pronounced aitch-tee-tee-pie) is a command-line HTTP client.Its goal is to make CLI interaction with web services as human-friendly as possible. I’ll continue to tweak this workflow as I use it more, but so far I like it muchīetter than clicking around the interfaces of GUI tools like PostMan/Insomnia. HTTPie releases unintuitive command flags from your brain and removes repetitive parameters completely. Here’s a short screen capture of me using this workflow: There should have been a video here but your browser does not seem Now I’m quickly sending authorized requests straight from Neovim and inspecting Makes sense to have it spanning multiple lines. Visual selection to tmux, in case a given command is particularly long and it I can also do a visual selection and press ts to send the current Now I can send requests to these endpoints by navigating to it in my endpointsīuffer and pressing tl to execute that line as a command in my shell. ![]() # get /products/ - delete product from favorites http delete /products/6 -session =fakestore ![]() The original httpie plugins commands are now hidden aliases. This provides a more scalable namespacing of the management subcommands. # get /products - all products http /products -session =fakestore Moved httpie plugins command to the new httpie cli plugins namespace. this simply tells HTTPie to send along the Accept: application/json header with the request, and it will save that header to theĮxample command for sending an initial request to an API endpoint: I’ll also use the -json flag to let the api know that i’d I’ll typically send an initial request using HTTPie which includes anĪuthentication token and the -session=session-name flag, and then I canĬontinue using that session name with HTTPie to quickly send authorized requests Specify a positive integer followed by a unit of time, which can be hours (h), minutes (m), or seconds (s). You can read moreĪbout how to use HTTPie sessions using their documentation. Amount of time a session can go unused before it is no longer valid, in seconds if unit of time isn't specified. Save endpoints, auth tokens, and other data for a given api. HTTPie allows you to save authentication tokens, custom headers, and otherĭata to a “session” file, which is similar to how postman/insomnia allow you to send current line as command to execute in tmux pane vim.keymap. Let lines = getline(line_start, line_end) Vn ts :VimuxRunCommand(VisualSelection()) send current visual selection as command to execute in tmux pane vim.cmd( [[ Tl - send current line as command to execute in tmux pane In Neovim, I configure keymaps which use the Vimux plugin to executeĬommands in an adjacent tmux pane directly from Neovim: ts - send current visual selection as command to execute in tmux pane It with tmux to create a tailored IDE experience, which I’ve been really happyįor HTTP API testing, I came up with the solution of combining the following tools: I’ve been using Neovim as my primary editor for years now, and I’ve combined To come up with an alternative more suited to my workflow. However, as someone who enjoys working in a terminal, I wanted These tools are great and offer a lot ofĬonvenience for quickly designing and testing endpoints. ![]() If you build stuff for the internet, you’re likely familiar with HTTP API testing tools such as Would be great to open the app directly by clicking the button while having auth session persist.HTTP API testing with Neovim + tmux + HTTPie When a user clicks the button, we send him first to the /authorize endpoint and then opening the app which hurts UX a bit.Which is quite a dirty approach and not part of a public interface of the library we use. GitHub - httpie/cli: HTTPie CLI modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more. That’s needed for getting code_verifier data for issuing a new token on a desktop app. HTTPie CLI modern, user-friendly command-line HTTP client for the API era. We extract transaction object from web session storage and give it to a desktop app.There are two issues with the given approach: Then we transfer the given code to the desktop app along with the transaction session object so we can issue a new OAuth token in the desktop application. In the current implementation, when the user clicks that button, we send him to /authorize endpoint which will redirect back to our application with the code provided. To provide a better user experience, we would like to retain the authentication session when user clicks on the button on the website so they don’t need to enter credentials manually in the desktop app. Authentication process is handled by library with refresh tokens. We have React application where we use Auth0 to manage authentication. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |