CopyRequest -> Copy & CopyAs

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2026-05-13 18:07:23 +02:00
parent de254b4e52
commit c7392474b7
15 changed files with 312 additions and 10 deletions
+2
View File
@@ -66,6 +66,8 @@ func (pr parsedRequest) fullURL() string {
func formatAs(id, raw, scheme string) string {
pr := parseRaw(raw, scheme)
switch id {
case "raw":
return raw
case "curl":
return toCurl(pr)
case "python":
+1
View File
@@ -36,6 +36,7 @@ func (f formatItem) Description() string { return f.desc }
func (f formatItem) FilterValue() string { return f.title }
var allFormats = []list.Item{
formatItem{"raw", "Raw", "raw HTTP request"},
formatItem{"curl", "cURL", "command line HTTP request"},
formatItem{"python", "Python", "requests library"},
formatItem{"go", "Go", "net/http package"},
+2 -2
View File
@@ -26,10 +26,10 @@ func (m *Model) View(background string) string {
popupH := m.popupHeight()
popup := style.RenderWithTitle(border, "Copy as", inner, popupInnerW+2, popupH)
return overlayCenter(background, popup, m.width, m.height)
return OverlayCenter(background, popup, m.width, m.height)
}
func overlayCenter(bg, popup string, w, h int) string {
func OverlayCenter(bg, popup string, w, h int) string {
s := style.S
stripped := ansi.Strip(bg)