"Open in new tab" for new HTTP handler only respects route after a page refresh #4423
Replies: 9 comments
-
There's a bit of a tricky question around "open a new tab", which is should they respect the request as it was made, or the request now. For example, if the path changed, we should clearly call the new URL. But it's not always possible to adapt the whole thing for the new thing. That's just a bit of context, as this code is a bit of a mess, and this is (partly) why. I fully support all fixes of this code: you'll discover it has quite a lot of other problems too. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure I understand. Describing an example where it's "not [...] possible to adapt the whole thing for the new thing" might help? |
Beta Was this translation helpful? Give feedback.
-
For example if the request was made to a path with no variables (such as |
Beta Was this translation helpful? Give feedback.
-
I appreciate that context - agreed, that's a tricky question, and I'm not sure what's "right." |
Beta Was this translation helpful? Give feedback.
-
Also, there's the same or very similar challenge with "copy as curl" |
Beta Was this translation helpful? Give feedback.
-
Coming up with clear rules for both would be a great step forward, as would documenting those rules. |
Beta Was this translation helpful? Give feedback.
-
copy-as-curl is based on the current trace, correct? If so, I think it'd be best to be re-branded as "copy trace as curl," and the trace should have everything it needs to produce the curl command. (in fact, the cURL command could be generated by a stdlib function, if Trace is a public type - handwavey a bit, but I think the idea is clear enough.) For GET handlers/traces specifically, an "open in new tab" should be rebranded to "open trace in new tab," again getting all context from the trace. Maybe all of that UI should exist when you hover on the trace icon on the left, rather than where it exists today. Separately, I'd like a feature separate from a specific trace:
Thinking now, this feels like a tiny version of Postman's UI. What do you think? |
Beta Was this translation helpful? Give feedback.
-
I like this. But also, the purpose of the curl command is to replay it, so if the handler has changed in someway, this does need to be reflected (e.g. the path is changed).
This sound good.
I'm guessing you're thinking "rewrite in Dark" - we can port refactoring functions to dark at some point, but this issue is more about the behaviour, right?
Can you open new issues for these? |
Beta Was this translation helpful? Give feedback.
-
Yes, you're right - I was thinking "rewrite in Dark," and that's a bit out of scope here.
That's fair - I think a next step here is to outline all possible classes of change to an HTTP handler, and determining which of them we can adjust the request for, appropriately: e.g. HTTP method changed -> we can easily produce a cURL to match. (I haven't gone through and listed the possible classes of change - we can follow up with that the next time someone visits this) |
Beta Was this translation helpful? Give feedback.
-
/route
The browser should direct to the equivalent BWD URL with the
/route
added, but it currently directs to the root of the BWD URL.This feature works as intended after a refresh of the page, though.
Beta Was this translation helpful? Give feedback.
All reactions