-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dump request and response for token exchange
- Loading branch information
1 parent
4c1d4f1
commit 86451e9
Showing
4 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package v1 | ||
|
||
import ( | ||
"fmt" | ||
"github.com/tidepool-org/platform/log" | ||
"net/http" | ||
"net/http/httputil" | ||
) | ||
|
||
type DebuggingTransport struct { | ||
Logger log.Logger | ||
} | ||
|
||
func (s *DebuggingTransport) RoundTrip(r *http.Request) (*http.Response, error) { | ||
bytes, _ := httputil.DumpRequestOut(r, true) | ||
|
||
resp, err := http.DefaultTransport.RoundTrip(r) | ||
// err is returned after dumping the response | ||
|
||
respBytes, _ := httputil.DumpResponse(resp, true) | ||
bytes = append(bytes, respBytes...) | ||
|
||
s.Logger.Debug(fmt.Sprintf("%s\n", string(bytes))) | ||
|
||
return resp, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters