You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is a bit cumbersome to manually select an entire request to be able to right-click and, for example, copy it as a curl command. I would like the extension to automatically determine a request's boundaries when no selection is made, so I could simply right-click anywhere within a request and perform actions with it. This issue is similar to #644/#645, but the proposed behavior is the opposite: generating code for a single request (the one around the current cursor position).
The auto-detection could be done by simple heuristics, such as reading the request body until the first blank line (as is currently done to separate the headers from the body); or alternatively, using something more elaborate such as reading until the next line that starts with an all-caps HTTP verb followed by an URL.
Of course, these heuristics would fail in some edge cases, but I'd argue that even so it would still be an improvement over the current behavior, since at the moment any requests under the first one get appended as data, which is never what one would want/expect. For example, given the following .http file:
# Example with JSON dataPOST https://api.example.com/addressContent-Type: application/json
{
"foo": "bar",
"baz": "qux"
}
# Example with query parametersGET https://example.com/comments?page=2&pageSize=10# Example with form-urlencoded dataPOST https://api.example.com/loginContent-Type: application/x-www-form-urlencodedname=foo&password=bar
...right-clicking on the "foo": "bar" line and generating a cURL command line yields the following:
@waldyrious you need to add request delimiter ### between requests to mark request boundary if you wish to put multiple requests in the same http file as following:
# Example with JSON dataPOST https://api.example.com/addressContent-Type: application/json
{
"foo": "bar",
"baz": "qux"
}
#### Example with query parametersGET https://example.com/comments?page=2&pageSize=10#### Example with form-urlencoded dataPOST https://api.example.com/loginContent-Type: application/x-www-form-urlencodedname=foo&password=bar
It is a bit cumbersome to manually select an entire request to be able to right-click and, for example, copy it as a curl command. I would like the extension to automatically determine a request's boundaries when no selection is made, so I could simply right-click anywhere within a request and perform actions with it. This issue is similar to #644/#645, but the proposed behavior is the opposite: generating code for a single request (the one around the current cursor position).
The auto-detection could be done by simple heuristics, such as reading the request body until the first blank line (as is currently done to separate the headers from the body); or alternatively, using something more elaborate such as reading until the next line that starts with an all-caps HTTP verb followed by an URL.
Of course, these heuristics would fail in some edge cases, but I'd argue that even so it would still be an improvement over the current behavior, since at the moment any requests under the first one get appended as data, which is never what one would want/expect. For example, given the following
.http
file:...right-clicking on the
"foo": "bar"
line and generating a cURL command line yields the following:while I would expect it to be instead:
The text was updated successfully, but these errors were encountered: