httplab

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2017 License: MIT Imports: 12 Imported by: 0

README

HTTPLab Build Status PRs Welcome

An interactive web server .

HTTPLabs let you inspect HTTP requests and forge responses.

screencast

Install

Golang
go install github.com/gchaincl/httplab/cmd/httplab
Archlinux
yaourt httplab
Snap

On systems where snap is supported:

snap install httplab
Binary distribution

Each release provides pre-built binaries for different architectures, you can download them here: https://github.com/gchaincl/httplab/releases/latest

Help

Usage of httplab:
  -config string
        Specifies custom config path.
  -port int
        Specifies the port where HTTPLab will bind to. (default 10080)
  -version
        Prints current version.
Key Bindings
Key Description
Tab Next Input
Shift+Tab Previous Input
Ctrl+a Apply Response changes
Ctrl+r Resets Request history
Ctrl+s Save Response as
Ctrl+f Save Request as
Ctrl+l Toggle Responses list
Ctrl+t Toggle Response builder
Ctrl+o Open Body file
Ctrl+b Switch Body mode
Ctrl+h Toggle Help
q Close popup
PgUp Previous Request
PgDown Next Request
Ctrl+c Quit

HTTPLab uses file to store pre-built responses, it will look for a file called .httplab on the current directory if not found it will fallback to $HOME. A sample file can be found here.

HTTPLab is heavily inspired by wuzz

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decolorize added in v0.3.0

func Decolorize(s []byte) []byte

func DumpRequest

func DumpRequest(req *http.Request) ([]byte, error)

func ExpandPath added in v0.2.0

func ExpandPath(path string) string

Types

type Body added in v0.2.0

type Body struct {
	Mode  BodyMode
	Input []byte
	File  *os.File
}

func (*Body) Info added in v0.2.0

func (body *Body) Info() []byte

func (*Body) Payload added in v0.2.0

func (body *Body) Payload() []byte

func (*Body) SetFile added in v0.2.0

func (body *Body) SetFile(path string) error

type BodyMode added in v0.2.0

type BodyMode uint

BodyMode represent the current Body mode

const (
	BodyInput BodyMode = iota + 1
	BodyFile
)

func (BodyMode) String added in v0.2.0

func (m BodyMode) String() string

type Response

type Response struct {
	Status  int
	Headers http.Header
	Body    Body
	Delay   time.Duration
}

func NewResponse

func NewResponse(status, headers, body string) (*Response, error)

func (*Response) MarshalJSON

func (r *Response) MarshalJSON() ([]byte, error)

func (*Response) UnmarshalJSON

func (r *Response) UnmarshalJSON(data []byte) error

func (*Response) Write

func (r *Response) Write(w http.ResponseWriter) error

type ResponsesList added in v0.3.0

type ResponsesList struct {
	List map[string]*Response
	// contains filtered or unexported fields
}

func NewResponsesList added in v0.3.0

func NewResponsesList() *ResponsesList

func (*ResponsesList) Add added in v0.3.0

func (rl *ResponsesList) Add(key string, r *Response) *ResponsesList

func (*ResponsesList) Cur added in v0.3.0

func (rl *ResponsesList) Cur() *Response

func (*ResponsesList) Del added in v0.3.0

func (rl *ResponsesList) Del(key string) bool

func (*ResponsesList) Get added in v0.3.0

func (rl *ResponsesList) Get(key string) *Response

func (*ResponsesList) Index added in v0.3.0

func (rl *ResponsesList) Index() int

func (*ResponsesList) Keys added in v0.3.0

func (rl *ResponsesList) Keys() []string

func (*ResponsesList) Len added in v0.3.0

func (rl *ResponsesList) Len() int

func (*ResponsesList) Load added in v0.3.0

func (rl *ResponsesList) Load(path string) error

func (*ResponsesList) Next added in v0.3.0

func (rl *ResponsesList) Next()

func (*ResponsesList) Prev added in v0.3.0

func (rl *ResponsesList) Prev()

func (*ResponsesList) Save added in v0.3.0

func (rl *ResponsesList) Save(path string) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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