Update oxy dependency
This commit is contained in:
parent
d81c4e6d1a
commit
07be89d6e9
31 changed files with 636 additions and 195 deletions
14
vendor/github.com/vulcand/oxy/utils/dumpreq.go
generated
vendored
14
vendor/github.com/vulcand/oxy/utils/dumpreq.go
generated
vendored
|
@ -9,6 +9,7 @@ import (
|
|||
"net/url"
|
||||
)
|
||||
|
||||
// SerializableHttpRequest serializable HTTP request
|
||||
type SerializableHttpRequest struct {
|
||||
Method string
|
||||
URL *url.URL
|
||||
|
@ -28,6 +29,7 @@ type SerializableHttpRequest struct {
|
|||
TLS *tls.ConnectionState
|
||||
}
|
||||
|
||||
// Clone clone a request
|
||||
func Clone(r *http.Request) *SerializableHttpRequest {
|
||||
if r == nil {
|
||||
return nil
|
||||
|
@ -47,14 +49,16 @@ func Clone(r *http.Request) *SerializableHttpRequest {
|
|||
return rc
|
||||
}
|
||||
|
||||
// ToJson serializes to JSON
|
||||
func (s *SerializableHttpRequest) ToJson() string {
|
||||
if jsonVal, err := json.Marshal(s); err != nil || jsonVal == nil {
|
||||
return fmt.Sprintf("Error marshalling SerializableHttpRequest to json: %s", err.Error())
|
||||
} else {
|
||||
return string(jsonVal)
|
||||
jsonVal, err := json.Marshal(s)
|
||||
if err != nil || jsonVal == nil {
|
||||
return fmt.Sprintf("Error marshalling SerializableHttpRequest to json: %s", err)
|
||||
}
|
||||
return string(jsonVal)
|
||||
}
|
||||
|
||||
// DumpHttpRequest dump a HTTP request to JSON
|
||||
func DumpHttpRequest(req *http.Request) string {
|
||||
return fmt.Sprintf("%v", Clone(req).ToJson())
|
||||
return Clone(req).ToJson()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue