mirror of
https://github.com/anotherhadi/spilltea.git
synced 2026-05-20 09:42:34 +02:00
Add the config option "keep responses"
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -45,6 +45,7 @@ type Config struct {
|
|||||||
|
|
||||||
History struct {
|
History struct {
|
||||||
SkipDuplicates bool `mapstructure:"skip_duplicates"`
|
SkipDuplicates bool `mapstructure:"skip_duplicates"`
|
||||||
|
KeepResponses bool `mapstructure:"keep_responses"`
|
||||||
} `mapstructure:"history"`
|
} `mapstructure:"history"`
|
||||||
|
|
||||||
Keybindings Keybindings `mapstructure:"keybindings"`
|
Keybindings Keybindings `mapstructure:"keybindings"`
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ replay:
|
|||||||
|
|
||||||
history:
|
history:
|
||||||
skip_duplicates: true # if true, skip saving entries with the same method, host, path and body
|
skip_duplicates: true # if true, skip saving entries with the same method, host, path and body
|
||||||
|
keep_responses: false # if true, response body and headers are stored in history
|
||||||
|
|
||||||
tui:
|
tui:
|
||||||
use_nerdfont_icons: false
|
use_nerdfont_icons: false
|
||||||
|
|||||||
@@ -177,7 +177,12 @@ func (b *Broker) SaveEntry(f *proxy.Flow) {
|
|||||||
Path: path,
|
Path: path,
|
||||||
StatusCode: status,
|
StatusCode: status,
|
||||||
RequestRaw: FormatRawRequest(f),
|
RequestRaw: FormatRawRequest(f),
|
||||||
ResponseRaw: FormatRawResponse(f),
|
ResponseRaw: func() string {
|
||||||
|
if config.Global.History.KeepResponses {
|
||||||
|
return FormatRawResponse(f)
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}(),
|
||||||
}
|
}
|
||||||
if cb := b.onBeforeNewEntry; cb != nil {
|
if cb := b.onBeforeNewEntry; cb != nil {
|
||||||
if !cb(pending) {
|
if !cb(pending) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"charm.land/bubbles/v2/key"
|
"charm.land/bubbles/v2/key"
|
||||||
tea "charm.land/bubbletea/v2"
|
tea "charm.land/bubbletea/v2"
|
||||||
|
"charm.land/lipgloss/v2"
|
||||||
"github.com/anotherhadi/spilltea/internal/db"
|
"github.com/anotherhadi/spilltea/internal/db"
|
||||||
"github.com/anotherhadi/spilltea/internal/keys"
|
"github.com/anotherhadi/spilltea/internal/keys"
|
||||||
"github.com/anotherhadi/spilltea/internal/style"
|
"github.com/anotherhadi/spilltea/internal/style"
|
||||||
@@ -299,5 +300,10 @@ func (m *Model) refreshBody() {
|
|||||||
} else {
|
} else {
|
||||||
raw = e.RequestRaw
|
raw = e.RequestRaw
|
||||||
}
|
}
|
||||||
|
if raw == "" {
|
||||||
|
w, h := m.bodyViewport.Width(), m.bodyViewport.Height()
|
||||||
|
m.bodyViewport.SetContent(lipgloss.Place(w, h, lipgloss.Center, lipgloss.Center, style.S.Faint.Render(" (˘・_・˘)\nno response stored")))
|
||||||
|
return
|
||||||
|
}
|
||||||
m.bodyViewport.SetContent(style.HighlightHTTP(raw))
|
m.bodyViewport.SetContent(style.HighlightHTTP(raw))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user