•  


GitHub - rclone/debughttp: A simple Go library to let you debug your HTTP transactions
Skip to content

A simple Go library to let you debug your HTTP transactions

License

Notifications You must be signed in to change notification settings

rclone/debughttp

Repository files navigation

rclone logo

Go Docs Build Status Go Report Card

debughttp

This is a go package to dump HTTP requests and responses

Install

Install like this

go get github.com/rclone/debughttp

and this will build the binary in $GOPATH/bin .

Usage

See the full docs or read on for a quickstart Instead of using http.Get or client.Get, use this

import
 github
.
com
/
rclone
/
debughttp


/
 Make
 a
 client
 with
 the
 defaults
 which
 dump
 headers
 to
 log
.
Printf

client
 :
=
 debughttp
.
NewClient
(
nil
)

// Now use the client, eg

resp
, 
err
 :=
 client
.
Get
(
"http://example.com"
)

This will log something like this

2020/05/03 16:06:03 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2020/05/03 16:06:03 HTTP REQUEST (req 0xc00022a300)
2020/05/03 16:06:03 GET / HTTP/1.1
Host: example.com
User-Agent: Go-http-client/1.1
Accept-Encoding: gzip

2020/05/03 16:06:03 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2020/05/03 16:06:03 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2020/05/03 16:06:03 HTTP RESPONSE (req 0xc00022a300)
2020/05/03 16:06:03 HTTP/1.1 200 OK
Accept-Ranges: bytes
Age: 518408
Cache-Control: max-age=604800
Content-Type: text/html; charset=UTF-8
Date: Sun, 03 May 2020 15:06:03 GMT
Etag: "3147526947"
Expires: Sun, 10 May 2020 15:06:03 GMT
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
Server: ECS (nyb/1D2A)
Vary: Accept-Encoding
X-Cache: HIT

2020/05/03 16:06:03 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

If you want to see the bodies of the transactions use this

// Make a client with the defaults which dump headers and bodies to log.Printf

client
 :=
 debughttp
.
NewClient
(
debughttp
.
DumpBodyOptions
)

Note that this redacts authorization headers by default.

For more info see the full documentation .

License

This is free software under the terms of the MIT license (check the LICENSE file included in this package).

This code was originally part of the rclone binary but was factored out to be of wider use.

Contact and support

The project website is at:

There you can file bug reports, ask for help or contribute patches.

About

A simple Go library to let you debug your HTTP transactions

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본