Skip to content

Commit

Permalink
new/maniphttp: added ExtractEncoding helper
Browse files Browse the repository at this point in the history
  • Loading branch information
primalmotion committed Apr 17, 2019
1 parent 319f152 commit 2eda7e7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions maniphttp/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"crypto/tls"
"net/http"

"go.aporeto.io/elemental"
"go.aporeto.io/manipulate"
)

Expand Down Expand Up @@ -63,6 +64,17 @@ func ExtractTLSConfig(manipulator manipulate.Manipulator) *tls.Config {
}
}

// ExtractEncoding returns the encoding used by the given manipulator.
func ExtractEncoding(manipulator manipulate.Manipulator) elemental.EncodingType {

m, ok := manipulator.(*httpManipulator)
if !ok {
panic("You can only pass a HTTP Manipulator to ExtractEncoding")
}

return m.encoding
}

// SetGlobalHeaders sets the given headers to all requests that will be sent.
func SetGlobalHeaders(manipulator manipulate.Manipulator, headers http.Header) {

Expand Down

0 comments on commit 2eda7e7

Please sign in to comment.