requestpane

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2025 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBodyTextArea

func NewBodyTextArea() textarea.Model

NewBodyTextArea creates a pre-configured body textarea

func NewConfiguredTextInput

func NewConfiguredTextInput(config TextInputConfig) textinput.Model

NewConfiguredTextInput creates a textinput.Model with the given configuration

func NewHeadersTextArea

func NewHeadersTextArea() textarea.Model

NewHeadersTextArea creates a pre-configured headers textarea

func NewLoadTestInput

func NewLoadTestInput(placeholder string, charLimit, width int) textinput.Model

NewLoadTestInput creates a pre-configured load test input field

func NewNameInput

func NewNameInput() textinput.Model

NewNameInput creates a pre-configured name input field

func NewURLInput

func NewURLInput(db *storage.SQLiteStorage) textinput.Model

NewURLInput creates a pre-configured URL input field

Types

type FieldIndex

type FieldIndex int

FieldIndex represents the index of a focusable field in the request pane

const (
	FieldMethodSelector FieldIndex = iota
	FieldURL
	FieldName
	FieldHeaders
	FieldBody
	FieldSubmitButton
)
const (
	FieldLTConcurrency FieldIndex = iota + 5
	FieldLTTotalReqs
	FieldLTQPS
	FieldLTTimeout
	FieldLTSubmit
)

Load test mode field indices (extend from base fields)

type LoadTestMode

type LoadTestMode struct{}

LoadTestMode implements the load test mode

func (*LoadTestMode) GetFocusManager

func (ltm *LoadTestMode) GetFocusManager(m *RequestPane) *ui.FocusManager

GetFocusManager returns the focus manager for load test mode

func (*LoadTestMode) GetFocusManagerWithIndex

func (ltm *LoadTestMode) GetFocusManagerWithIndex(m *RequestPane, index int) *ui.FocusManager

GetFocusManagerWithIndex returns the focus manager for load test mode starting at a specific index

func (*LoadTestMode) HandleInput

func (ltm *LoadTestMode) HandleInput(m *RequestPane, msg tea.KeyMsg) (tea.Model, tea.Cmd)

HandleInput handles keyboard input in load test mode

func (*LoadTestMode) OnEnter

func (ltm *LoadTestMode) OnEnter(m *RequestPane)

OnEnter is called when entering load test mode

func (*LoadTestMode) OnExit

func (ltm *LoadTestMode) OnExit(m *RequestPane)

OnExit is called when exiting load test mode

type ModeStrategy

type ModeStrategy interface {
	// HandleInput handles keyboard input for this mode
	HandleInput(m *RequestPane, msg tea.KeyMsg) (tea.Model, tea.Cmd)

	// GetFocusManager returns the focus manager for this mode
	GetFocusManager(m *RequestPane) *ui.FocusManager

	// GetFocusManagerWithIndex returns the focus manager for this mode starting at a specific index
	GetFocusManagerWithIndex(m *RequestPane, index int) *ui.FocusManager

	// OnEnter is called when entering this mode
	OnEnter(m *RequestPane)

	// OnExit is called when exiting this mode
	OnExit(m *RequestPane)
}

ModeStrategy defines the interface for different request pane modes (normal, load test, etc.)

type NormalMode

type NormalMode struct{}

NormalMode implements the standard request mode

func (*NormalMode) GetFocusManager

func (nm *NormalMode) GetFocusManager(m *RequestPane) *ui.FocusManager

GetFocusManager returns the focus manager for normal mode

func (*NormalMode) GetFocusManagerWithIndex

func (nm *NormalMode) GetFocusManagerWithIndex(m *RequestPane, index int) *ui.FocusManager

GetFocusManagerWithIndex returns the focus manager for normal mode starting at a specific index

func (*NormalMode) HandleInput

func (nm *NormalMode) HandleInput(m *RequestPane, msg tea.KeyMsg) (tea.Model, tea.Cmd)

HandleInput handles keyboard input in normal mode

func (*NormalMode) OnEnter

func (nm *NormalMode) OnEnter(m *RequestPane)

OnEnter is called when entering normal mode

func (*NormalMode) OnExit

func (nm *NormalMode) OnExit(m *RequestPane)

OnExit is called when exiting normal mode

type RequestPane

type RequestPane struct {
	Client *http.Client

	Stopwatch stopwatch.Model
	Quitting  bool

	PanelFocused bool

	FocusManager *ui.FocusManager

	MethodSelector *ui.MethodSelector
	URLInput       *textinput.Model
	NameInput      *textinput.Model
	Headers        *textarea.Model
	Body           *textarea.Model
	SubmitButton   *ui.SubmitButton

	Request *http.Request

	Height int

	ParseErrors []string

	HeadersExpanded bool
	BodyExpanded    bool

	RequestInProgress bool

	DB *storage.SQLiteStorage

	// Load test mode fields
	LoadTestMode bool

	LoadTestConcurrency *textinput.Model
	LoadTestTotalReqs   *textinput.Model
	LoadTestQPS         *textinput.Model
	LoadTestTimeout     *textinput.Model
	// contains filtered or unexported fields
}

RequestPane is the main component for handling HTTP request input

func SetupRequestPane

func SetupRequestPane(db *storage.SQLiteStorage) RequestPane

SetupRequestPane creates and initializes a new RequestPane

func (*RequestPane) ExitLoadTestMode

func (m *RequestPane) ExitLoadTestMode()

ExitLoadTestMode exits load test mode and resets state

func (*RequestPane) GetCurrentMethod

func (m *RequestPane) GetCurrentMethod() string

GetCurrentMethod returns the currently selected HTTP method

func (RequestPane) Init

func (m RequestPane) Init() tea.Cmd

Init initializes the request pane

func (*RequestPane) ResultMsgCleanup

func (m *RequestPane) ResultMsgCleanup()

ResultMsgCleanup resets the stopwatch and request state after a response

func (*RequestPane) SetFocused

func (m *RequestPane) SetFocused(focused bool)

SetFocused sets the panel focus state

func (*RequestPane) SetHeight

func (m *RequestPane) SetHeight(height int)

SetHeight sets the height of the request pane

func (RequestPane) Update

func (m RequestPane) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles updates to the request pane

func (RequestPane) View

func (m RequestPane) View() string

View renders the request pane

type TextInputConfig

type TextInputConfig struct {
	Placeholder     string
	CharLimit       int
	Width           int
	Value           string
	Suggestions     []string
	ShowSuggestions bool
}

TextInputConfig holds configuration for creating a textinput.Model

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL