-
Notifications
You must be signed in to change notification settings - Fork 89
Using Custom HTTP Client
Hemanth Chittanuru edited this page Aug 4, 2020
·
1 revision
MSAL Go uses interfaces called HTTPManager
and HTTPManagerResponse
to handle its HTTP operations. A default implementation of this interface is provided and is automatically used; however, if you want to use a custom HTTP client, all you need to do is provide implementations of these interfaces.
type HTTPManager interface {
Get(url string, requestHeaders map[string]string) (HTTPManagerResponse, error)
Post(url string, body string, requestHeaders map[string]string) (HTTPManagerResponse, error)
}
type HTTPManagerResponse interface {
GetResponseCode() int
GetResponseData() string
GetHeaders() map[string]string
}
After creating implentations of these interfaces, you can just set the HTTPManager
of the public/confidential client app instance.
clientApp.SetHTTPManager(customHTTPManager)