federicotdn / verb

Organize and send HTTP requests from Emacs
https://melpa.org/#/verb
GNU General Public License v3.0
523 stars 21 forks source link

Allow query params to span multiple lines #70

Closed misaka closed 2 months ago

misaka commented 3 months ago

I'd like to be able to define the query params for a request across multiple lines for sake of readability. For example, I have the following request:

get ?_fuzzy-match=false&_exact-match=false&_history=true&_max-results=1&family=Smith&given=Jane&gender=female&birthdate=eq2010-10-22&death-date=eq2010-10-22&address-postcode=LS1+6AE&general-practitioner=Y12345&email=jane.smith%40example.com&phone=01632960587

This is quite hard to parse and understand. I can use the org hierarchy to create sub-headings which will merge query params, but with so many params it's still quite noisy and requires that I create a hierarchy that I wouldn't otherwise bother with. Something like this would be nice, just as an example:

get ?_fuzzy-match=false\
    &_exact-match=false\
    &_history=true\
    &_max-results=1\
    &family=Smith\
    &given=Jane\
    &gender=female\
    &birthdate=eq2010-10-22\
    &death-date=eq2010-10-22\
    &address-postcode=LS1+6AE\
    &general-practitioner=Y12345\
    &email=jane.smith%40example.com\
    &phone=01632960587
federicotdn commented 3 months ago

That shouldn't be too difficult to implement 🤔 Do/can backslashes have special meanings in URLs? That's the only potential problem I can think of in using backslashes.

federicotdn commented 2 months ago

Implemented in https://github.com/federicotdn/verb/commit/d96ffeb8b8442c857c5aff0650bc75c4b5faa5da