Skip to content

Commit

Permalink
graph: Temporarily disable gzip compression in requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Barnes committed Nov 8, 2023
1 parent e38454a commit 39e925d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/util/graph/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,17 @@ func (t *DebugTransport) RoundTrip(req *http.Request) (*http.Response, error) {
// Returns:
// a new GraphRequestAdapter
func NewGraphRequestAdapter(authenticationProvider absauth.AuthenticationProvider) (*GraphRequestAdapter, error) {
httpClient := kiotahttp.GetDefaultClient()
// XXX Temporary workaround for https://portal.microsofticm.com/imp/v3/incidents/details/439391116/home.
// The Graph service is not handling gzipped requests properly, but Kiota's HTTP client gzips by default.
// This middleware list is equivalent to kiotahttp.GetDefaultMiddlewares, minus the CompressionHandler.
middlewares := []kiotahttp.Middleware{
kiotahttp.NewRetryHandler(),
kiotahttp.NewRedirectHandler(),
kiotahttp.NewParametersNameDecodingHandler(),
kiotahttp.NewUserAgentHandler(),
}

httpClient := kiotahttp.GetDefaultClient(middlewares...)
if _, doTrace := os.LookupEnv(ENV_DEBUG_TRACE); doTrace {
httpClient.Transport = &DebugTransport{Transport: httpClient.Transport}
}
Expand Down

0 comments on commit 39e925d

Please sign in to comment.