hurl.nvim
hurl.nvim copied to clipboard
Feature/url show and repeat history
WHAT
Added two features that I have made that might be helpful for others.
- Re-run last query that was made (helpful so that this can be done anywhere and not a specific hurl file) through the
HurlRerun
- Add the url in the headers to know against which endpoint the hurl command was run (found it difficult to check).
WHY
Not sure if that's needed, but for me I find quite helpful to be able to rerun last request without having to go to the hurl file. Then if you make a change anywhere, you can rerun and the hurl command and see the results.
For the url, I think it makes sense to be able to see the url of the request in the endpoint headers (especially when this is not a localhost where you can see directly, but also makes easier to copy paste things. Not sure if it should go on the headers, added it there for simplicity.
So feel free to reject if you find this redundant.
HOW
- The rerun is done by caching with deepcopy the last opts through the HurlRerun command.
- The url acquisition is done by using the hurl file and finding the GET/POST/PUT/DELETE and using that url. Bonus is that if something is parameterized, you have the option to select if you want the proper url or the parameterized url, based on the global config. Example: url | GET {{HOST}}/user/group-accesses or url | GET localhost:8000/user/group-accesses
Screenshots (if appropriate):
Screenshot from 2024-10-07 11-11-34
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [ ] Linter
- [ ] Tests
- [ ] Review comments
- [ ] Security
[!IMPORTANT] Add rerun command and URL display feature to Hurl plugin, enhancing request management and visibility.
- Features:
- Add
HurlRerun
command inmain.lua
to rerun the last executed request using cached options.- Display request URL in response headers in
popup.lua
andsplit.lua
ifurl.show
is enabled in config.- Configuration:
- Add
url
config ininit.lua
with optionsshow
andformat_without_params
.- Utilities:
- Implement
get_url_from_hurl_file()
andconvert_url_to_proper_format()
inutils.lua
to extract and format URLs from Hurl files.This description was created by
for d7e952a0cba6773594e911acdf4ce095234a4072. It will automatically update as commits are pushed.
Summary by CodeRabbit
Release Notes
-
New Features
- Introduced a new
url
configuration for enhanced URL handling. - Added a
HurlRerun
command to easily rerun the last executed HTTP request. - New utility functions for extracting and formatting URLs from
.hurl
files.
- Introduced a new
-
Improvements
- Enhanced header population to include URLs in responses.
- Improved overall usability of the Hurl command with better request management.