gindump

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: MIT Imports: 9 Imported by: 66

README

gin-dump

Gin middleware/handler to dump header/body of request and response .

Very helpful for debugging your applications.

Content-type support / todo

  • application/json
  • application/x-www-form-urlencoded
  • text/xml
  • application/xml
  • text/plain

Usage

Start using it

Download and install it:

$ go get github.com/tpkeeper/gin-dump

Import it in your code:

import "github.com/tpkeeper/gin-dump"
Canonical example:
package main

import (
	"time"
	"github.com/gin-gonic/gin"
	"github.com/tpkeeper/gin-dump"
)

func main() {
	router := gin.Default()
	
	router.Use(gindump.Dump())
	//...
	router.Run()
}
Output is as follows
[GIN-dump]:
Request-Header:
        {
                        Content-Length : [66]
                        Content-Type : [application/json;charset=utf-8]
                        Accept-Encoding : [gzip]
                        User-Agent : [Go-http-client/1.1]
        }

Request-Body:
        {
                        sms_code : 1111
                        telephone : 18322889845
                        password : lfajkdffsefadfare
        }

Response-Header:
        {
                        Content-Type : [application/json; charset=utf-8]
        }

Response-Body:
        {
                        data : sms_code error
                        ok : %!s(bool=false)
        }

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump() gin.HandlerFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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