httpbin

package
v0.0.0-...-df3c987 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2018 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestToJSON

func RequestToJSON(r *http.Request, keys requestKeys) ([]byte, error)

RequestToJSON parses an incoming http request and returns a bytes.Buffer containing a properly indented, JSON formatted httpbin.Request

Types

type Request

type Request struct {
	Args      map[string]string `json:"args"`
	Data      string            `json:"data"`
	Files     map[string]string `json:"files"`
	Form      map[string]string `json:"form"`
	Headers   map[string]string `json:"headers"`
	JSON      string            `json:"json"`
	Origin    string            `json:"origin"`
	URL       string            `json:"url"`
	Method    string            `json:"method"`
	UserAgent string            `json:"user-agent"`
	Gzipped   bool              `json:"gzipped"`
}

Request represents http request metadata

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents the server

func NewServer

func NewServer(router *mux.Router) (*Server, error)

NewServer builds and returns a new server

func (*Server) ListenAndServe

func (s *Server) ListenAndServe()

ListenAndServe starts the http listener

Jump to

Keyboard shortcuts

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