Update go dependencies
This commit is contained in:
parent
f9624cbe46
commit
307bf76454
280 changed files with 54728 additions and 2991 deletions
24
vendor/github.com/moul/http2curl/.gitignore
generated
vendored
Normal file
24
vendor/github.com/moul/http2curl/.gitignore
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
23
vendor/github.com/moul/http2curl/.travis.yml
generated
vendored
Normal file
23
vendor/github.com/moul/http2curl/.travis.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.7.3
|
||||
- tip
|
||||
|
||||
env:
|
||||
- GO15VENDOREXPERIMENT=1
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- go: tip
|
||||
|
||||
before_install:
|
||||
- go get -u github.com/axw/gocov/gocov
|
||||
- go get -u github.com/mattn/goveralls
|
||||
- go get golang.org/x/tools/cmd/cover
|
||||
|
||||
script:
|
||||
- make build
|
||||
- make test
|
||||
- make cover
|
||||
- goveralls -service=travis-ci -v -covermode=count -coverprofile=profile.out
|
||||
22
vendor/github.com/moul/http2curl/LICENSE
generated
vendored
Normal file
22
vendor/github.com/moul/http2curl/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Manfred Touron
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
50
vendor/github.com/moul/http2curl/Makefile
generated
vendored
Normal file
50
vendor/github.com/moul/http2curl/Makefile
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# Project-specific variables
|
||||
CONVEY_PORT ?= 9042
|
||||
|
||||
|
||||
# Common variables
|
||||
SOURCES := $(shell find . -type f -name "*.go")
|
||||
COMMANDS := $(shell go list ./... | grep -v /vendor/ | grep /cmd/)
|
||||
PACKAGES := $(shell go list ./... | grep -v /vendor/ | grep -v /cmd/)
|
||||
GOENV ?= GO15VENDOREXPERIMENT=1
|
||||
GO ?= $(GOENV) go
|
||||
GODEP ?= $(GOENV) godep
|
||||
USER ?= $(shell whoami)
|
||||
|
||||
|
||||
all: build
|
||||
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
echo "nothing to do"
|
||||
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
$(GO) get -t .
|
||||
$(GO) test -v .
|
||||
|
||||
|
||||
.PHONY: godep-save
|
||||
godep-save:
|
||||
$(GODEP) save $(PACKAGES) $(COMMANDS)
|
||||
|
||||
|
||||
.PHONY: re
|
||||
re: clean all
|
||||
|
||||
|
||||
.PHONY: convey
|
||||
convey:
|
||||
$(GO) get github.com/smartystreets/goconvey
|
||||
goconvey -cover -port=$(CONVEY_PORT) -workDir="$(realpath .)" -depth=1
|
||||
|
||||
|
||||
.PHONY: cover
|
||||
cover: profile.out
|
||||
|
||||
|
||||
profile.out: $(SOURCES)
|
||||
rm -f $@
|
||||
$(GO) test -covermode=count -coverpkg=. -coverprofile=$@ .
|
||||
42
vendor/github.com/moul/http2curl/README.md
generated
vendored
Normal file
42
vendor/github.com/moul/http2curl/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# http2curl
|
||||
:triangular_ruler: Convert Golang's http.Request to CURL command line
|
||||
|
||||
[](https://travis-ci.org/moul/http2curl)
|
||||
[](https://godoc.org/github.com/moul/http2curl)
|
||||
[](https://coveralls.io/github/moul/http2curl)
|
||||
|
||||
To do the reverse, check out [mholt/curl-to-go](https://github.com/mholt/curl-to-go).
|
||||
|
||||
## Example
|
||||
|
||||
```go
|
||||
import "http"
|
||||
import "github.com/moul/http2curl"
|
||||
|
||||
data := bytes.NewBufferString(`{"hello":"world","answer":42}`)
|
||||
req, _ := http.NewRequest("PUT", "http://www.example.com/abc/def.ghi?jlk=mno&pqr=stu", data)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
command, _ := http2curl.GetCurlCommand(req)
|
||||
fmt.Println(command)
|
||||
// Output: curl -X PUT -d "{\"hello\":\"world\",\"answer\":42}" -H "Content-Type: application/json" http://www.example.com/abc/def.ghi?jlk=mno&pqr=stu
|
||||
```
|
||||
|
||||
## Install
|
||||
|
||||
```php
|
||||
$ go get github.com/moul/http2curl
|
||||
```
|
||||
|
||||
## Usages
|
||||
|
||||
- https://github.com/parnurzeal/gorequest
|
||||
- https://github.com/scaleway/scaleway-cli
|
||||
- https://github.com/nmonterroso/cowsay-slackapp
|
||||
- https://github.com/moul/as-a-service
|
||||
- https://github.com/gavv/httpexpect
|
||||
- https://github.com/smallnest/goreq
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
71
vendor/github.com/moul/http2curl/http2curl.go
generated
vendored
Normal file
71
vendor/github.com/moul/http2curl/http2curl.go
generated
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
package http2curl
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// CurlCommand contains exec.Command compatible slice + helpers
|
||||
type CurlCommand struct {
|
||||
slice []string
|
||||
}
|
||||
|
||||
// append appends a string to the CurlCommand
|
||||
func (c *CurlCommand) append(newSlice ...string) {
|
||||
c.slice = append(c.slice, newSlice...)
|
||||
}
|
||||
|
||||
// String returns a ready to copy/paste command
|
||||
func (c *CurlCommand) String() string {
|
||||
return strings.Join(c.slice, " ")
|
||||
}
|
||||
|
||||
// nopCloser is used to create a new io.ReadCloser for req.Body
|
||||
type nopCloser struct {
|
||||
io.Reader
|
||||
}
|
||||
|
||||
func bashEscape(str string) string {
|
||||
return `'` + strings.Replace(str, `'`, `'\''`, -1) + `'`
|
||||
}
|
||||
|
||||
func (nopCloser) Close() error { return nil }
|
||||
|
||||
// GetCurlCommand returns a CurlCommand corresponding to an http.Request
|
||||
func GetCurlCommand(req *http.Request) (*CurlCommand, error) {
|
||||
command := CurlCommand{}
|
||||
|
||||
command.append("curl")
|
||||
|
||||
command.append("-X", bashEscape(req.Method))
|
||||
|
||||
if req.Body != nil {
|
||||
body, err := ioutil.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Body = nopCloser{bytes.NewBuffer(body)}
|
||||
bodyEscaped := bashEscape(string(body))
|
||||
command.append("-d", bodyEscaped)
|
||||
}
|
||||
|
||||
var keys []string
|
||||
|
||||
for k := range req.Header {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
|
||||
for _, k := range keys {
|
||||
command.append("-H", bashEscape(fmt.Sprintf("%s: %s", k, strings.Join(req.Header[k], " "))))
|
||||
}
|
||||
|
||||
command.append(bashEscape(req.URL.String()))
|
||||
|
||||
return &command, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue