Skip to content

Conversation

@Kaligule
Copy link

Especially when working with a lot of query parameters it might be useful to split lines.
Therefore, lines that start with \ (or whatever matches ob-http:join-line-marker)
will be merged into the previous line before processing.

So the following lines would be equivalent:

#+BEGIN_SRC http
GET https://api.github.com/repos/zweifisch/ob-http/pulls
\?state=open
\&sort=created-asc
\&no-assignee
#+end_src
#+BEGIN_SRC http
GET https://api.github.com/repos/zweifisch/ob-http/pulls?state=open&sort=created-asc&no-assignee
#+end_src

This can make long requests (especially with query parameters) more
readable, like this:

GET http://localhost/test
\?key1=value1
\&key2=value2
\&key3=value3
@ewestbrook
Copy link

If backslashes must be used, I would find it more customary and natural to use them at the end of the previous line rather than the beginning of the next. But even better IMO, consistent with RFC 822, a continuation line should be indicated by whitespace at the beginning of the continued line. Just an opinion for consideration.

This was suggested by github user ewestbrook and follows the RFC822
more closely.
@Kaligule
Copy link
Author

Kaligule commented Feb 1, 2022

@ewestbrook Awesome suggestion. The default value for ob-http:join-line-marker was \\\\ (which is the easiest regex for a single backslash I could find) but I now changed it to [ \t]+ (so one or more spaces or tabs).

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

Successfully merging this pull request may close these issues.

2 participants