Giter Site home page Giter Site logo

httplab's Introduction

HTTPLAB

Build Status Go Report Card PRs Welcome

The interactive web server.

HTTPLabs let you inspect HTTP requests and forge responses.


screencast

Install

Golang

go install github.com/gchaincl/httplab/cmd/httplab@latest

Archlinux

yaourt httplab

Snap FIXME

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:
  -a, --auto-update       Auto-updates response when fields change. (default true)
  -b, --body string       Specifies the inital response body. (default "Hello, World")
  -c, --config string     Specifies custom config path.
      --cors              Enable CORS.
      --cors-display      Display CORS requests. (default true)
  -d, --delay int         Specifies the initial response delay in ms.
  -H, --headers strings   Specifies the initial response headers. (default [X-Server:HTTPLab])
  -p, --port int          Specifies the port where HTTPLab will bind to. (default 10080)
  -s, --status string     Specifies the initial response status. (default "200")
  -v, --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
Ctrl+w Toggle line wrapping
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

httplab's People

Contributors

dnguy078 avatar dvrkps avatar guglielmobartelloni avatar haraldnordgren avatar harleo avatar jcchavezs avatar m1ome avatar maciekmm avatar popey avatar pradeepchhetri avatar quasilyte avatar qustavo avatar sponomarev avatar srini156 avatar testwill avatar vjeantet avatar waleoyediran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

httplab's Issues

Execution steps for Windows 7

Hi,

I have installed go on my Machine and then tried the go get command. The command completed without any response. Kindly let me know how can I run this app in Windows 7. I am new to Go, so detailed instructions or any link will be very helpful for me

Regards
Saravanan

Graceful shutdown

Would be nice to enable graceful shutdown. Meaning that if there's an active connection at the moment the user sends a kill signal (Ctrl + C) HTTPLab will wait until all the connection has been closed.
Once signal has been sent, a message should be displayed with a message like: "HTTPLab is shutting down".

Preserve CORS preflight requests and reponses

Thanks for adding CORS preflight support!
It would be helpful if the preflight requests and responses could be preserved in the Request history so that you could page through them and see what happened.

Form POST hard to view

The body of form POST requests is very hard to read due to there being no word wrapping and home/end buttons not working, see:

screenshot from 2017-04-20 11-24-26

Location header not rendered to client

Hello,

When i set Location: http://google.fr in Headers panel, this header never write out to the client.
the : seems to cause the issue, because when i set `Location: http//google.fr' it works

Text selecting support using mouse

Unless you're using tmux (or some terminal multiplexer) copying text to the clipboard it's hard, this is mainly because you can't select text using the mouse.
This would be a nice to have feature.

Fix header and body editor behavior

Both editors move the cursor down when the key arrow down key is pressed, even when there's no more text on the buffer, current behaviour should do nothing when end of buffer is reached

Body (Input) is not updated

Hi,

maybe I am missing something very obvious, but for me the Editor field for "Body (Input)" is not working.

Changes, which I make to the Status, Delay or Header Fields take effect.
When I load a predefined Reponse body from the .httplab file, the changes take effect.
But when I enter a Response Body by hand in the editor field, the body returned does not reflect the change (regardless, whether I stay in the Editor, change to another input field, use Ctrl-A for updating the response or not)

Any ideas, why this happens? I have tried to locate the issue, but since I do not know go, it is quite hard.

Create a logo

I haven't been able to come up with a good logo.
I'd love to see some proposals, the most ๐Ÿ‘ voted will be chosen!

Create a generic install script

Projects like brew provides a handy way to install.
It would be great to have something similar that depending on your architecture, fetches the righ binary and copies it to some $PATH.

A simple bash script should be enough to start,

can not run ?

Just git clone the repository and go run main.go, but it show below message

# command-line-arguments
./main.go:13: undefined: UI
./main.go:16: undefined: DumpRequest
./main.go:42: undefined: NewUI

Customizable keybindings

Having configurable key bindings would be a nice addition.
I can implement this to store custom key bindings in ~/.httplab, is this a good place for such change?

How to use it?

i run httplab on macos iterm2 and it run the httplab interface like the GIF in readme. But when i do a httplab example.com to actually send a request to httplab, i have the error "listen tcp :10080: bind: address already in use". I try to do like the GIF.

Make ui more compact

Currently, the widgets (status, delay, headers, body and info bar) uses too much spacing between them.
The right stack (status code, delay, headers and body) can remove some spacing by overlapping them.
The info bar does not display relevant information and most of the time is empty, possibles solutions are either a) remove the border (Frame = false) so that we can use less vertical space or b) Make it popup for a specific time, and then make it dissapear.

No information returned

$uri="172.245.118.60"
$headers=@{
"content-length"= "215"
"cache-control"= "max-age=0"
"upgrade-insecure-requests"= "1"
"user-agent"= "Mozilla/5.0 (Linux; Android 9; LM-G710) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Mobile Safari/537.36"
"sec-fetch-mode"= "navigate"
"sec-fetch-user"= "?1"
"content-type"= "application/x-www-form-urlencoded"
"dnt"= "1"
"accept"= "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3"
"sec-fetch-site"= "none"
"accept-encoding"= "gzip, deflate, br"
"accept-language"= "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"
}
Invoke-WebRequest $uri -Method Post -Headers $headers

Configuration file

Would be super neat if the tool could either pick up the .httplab config file from the current directory or via command line argument (similar to the port configuration).
That would allow to have different saved requests for different projects and also to version control the saved requests.

Can't load package: package github.com/gchaincl/httplab/cmd/httplab

I'm not a Go developer, so only following the instruction in the README:

$ go install github.com/gchaincl/httplab/cmd/httplab
can't load package: package github.com/gchaincl/httplab/cmd/httplab: cannot find package "github.com/gchaincl/httplab/cmd/httplab" in any of:
	/usr/local/go/src/github.com/gchaincl/httplab/cmd/httplab (from $GOROOT)
	/home/user/go/src/github.com/gchaincl/httplab/cmd/httplab (from $GOPATH)

There is a remote location to install this package? Do I have to download the sources an place them into the /usr/local/go/ folder to install it? Because /usr/local/go is not a user folder, It shouldn't be required to install an app like this, and isn't specified in the README instructions.

Support Environment Variables in Body File

As an enhancement of #14, another nice-to-have feature would be the support of environment variables for the string specifying the response file.

This should open up many convenient use cases.

E.g. ~/test.txt expands to /home/jack/test.txt

But also: $HOME, $TMP, $USER, $PATH, $LANGUAGE ...

Choose our logo

In issue #58, we had some prototype logos, I've put together all are the options, so let's vote and I'll merge the winner.


Option A
httplab-logo-a1


Option B
httplab-logo-b


Option C
httplab-logo-c


Option D
httplab-logo-d


Option E
httplab-logo-e


Option F
httplab-logo-f


Vote here by clicking on the want you like:






Buffer Request Pane

Would be nice to be able to scroll through previous requests, or support having multiple requests on-screen at once.

Useful when debugging something that sends multiple different payloads - can just point them all at httplab and understand the flow.

Update ASCII animation

Lot of UI improvements has happened and it would be nice to have them on the ASCII animation

Support non text responses

Only plain text responses are supported now, non text like binaries needs to be supported, this would probably involve changes on the UI as well.

different routes

if it provides a feature that I could define different routes (and dynamic routes) it'd be a great tool for mocking API.

then it would need a way to export the setups and definitions to be able to reuse again.

Display request headers sorted

As request headers are implemented as a map, the order of the keys are not guaranteed.
It would be nice to display all the request header sorted alphabetically, so that is easy to identify changes from one request to the other

Can't read wide results

The data sent with a POST was a single very long line.

I could only read the beginning of the line; there seems to be no way to wrap the output received.

go/pkg/mod/github.com/gchaincl/[email protected]/ui/ui.go:128:5: g.Execute undefined (type *gocui.Gui has no field or method Execute)

Hello, I am trying to install the package on freshly installed go1.20.4 darwin/amd64. This is my error trace

go install github.com/gchaincl/httplab/cmd/httplab@latest
go: finding module for package github.com/spf13/pflag
go: finding module for package github.com/jroimartin/gocui
go: finding module for package github.com/rs/cors
go: found github.com/jroimartin/gocui in github.com/jroimartin/gocui v0.5.0
go: found github.com/rs/cors in github.com/rs/cors v1.9.0
go: found github.com/spf13/pflag in github.com/spf13/pflag v1.0.5
# github.com/gchaincl/httplab/ui
go/pkg/mod/github.com/gchaincl/[email protected]/ui/ui.go:128:5: g.Execute undefined (type *gocui.Gui has no field or method Execute)
go/pkg/mod/github.com/gchaincl/[email protected]/ui/ui.go:319:4: g.Execute undefined (type *gocui.Gui has no field or method Execute)
go/pkg/mod/github.com/gchaincl/[email protected]/ui/ui.go:329:5: g.Execute undefined (type *gocui.Gui has no field or method Execute)
go/pkg/mod/github.com/gchaincl/[email protected]/ui/ui.go:343:4: g.Execute undefined (type *gocui.Gui has no field or method Execute)

any ideas what am I missing?

Vendor dependencies

This is a cool project and I'd like to be able to use it, but I have another version of gocui installed that doesn't jive with this project. When I try to build:

go get github.com/gchaincl/httplab

github.com/gchaincl/httplab

../../gchaincl/httplab/main.go:36: undefined: gocui.Output256
../../gchaincl/httplab/main.go:36: too many arguments in call to gocui.NewGui
../../gchaincl/httplab/main.go:36: assignment count mismatch: 2 = 1
../../gchaincl/httplab/ui.go:106: g.Highlight undefined (type *gocui.Gui has no field or method Highlight)
../../gchaincl/httplab/ui.go:127: v.Editor undefined (type *gocui.View has no field or method Editor)
../../gchaincl/httplab/ui.go:154: v.Editor undefined (type *gocui.View has no field or method Editor)
../../gchaincl/httplab/ui.go:165: v.Editor undefined (type *gocui.View has no field or method Editor)
../../gchaincl/httplab/ui.go:174: v.Editor undefined (type *gocui.View has no field or method Editor)
../../gchaincl/httplab/ui.go:187: v.Editor undefined (type *gocui.View has no field or method Editor)
../../gchaincl/httplab/ui.go:195: assignment count mismatch: 2 = 1
../../gchaincl/httplab/ui.go:195: too many errors

I'd be able to try it out easily if you could vendor gocui and friends.

Document the API using Godoc

At some point, HTTPLab should be able to be used as a library, so that you can build your own frontends. To do so, we need to start documenting it properly.

Can't backspace values

Windows 7

I can only insert values; I can't type over or delete.
Backspace brings up a keybinding menu.

"Save response as" not working

I tried to do "Save response as", and got the message "open /home/steven/.httplab: permission denied".

I tried making a directory .httplab (complained that it was a directory), and later a text file (complained permission denied).

I tried saving using a relative file name, and a full file name, and nothing was saved.

Problems rendering on tmux

There are some issues when using it inside tmux 2.9a, it renders incorrec
t characters and doesn't allow to use arrow keys, neither to use it at all actually, tried in different terminals:

  • Termite
  • rxvt-unicode
  • xterm
  • alacritty

using both zsh and bash and evertything works fine on it's own, but in tmux it presents this problem (screenshot in link)

I'm using archlinux and tmux 2.9a

tried installation from AUR, with golang and from source, problem persists and it's only when inside tmux

[screenshot](https://i.imgur.com/J9lV3I5.

Edit

it works when changing TERM variable inside tmux either from tmux-256color to tmux or screen-256color to screen

CORS "Preflight" support

I was trying to POST data from a form, but it was sending a CORS preflight request first.
I could handle this case by adding
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT
Access-Control-Allow-Headers: content-type
to the returned headers, and then at least the POST data was submitted. But then I had no control over the response to the POST.

Support for HTTPS

it would be really helpful for fast development and debugging of an existing API.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.