-
Hi! but response body is empty. IN go sdk I'm hugely thankful for any helpful response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @Maki079, thanks for highlighting such scenarios. Here is an example of the code // define a response handler
responseHandler := func(response interface{}, errorMappings abstractions.ErrorMappings) (interface{}, error) {
// cast response to the type you expect
httpRes := response.(*http.Response)
// read the headers
fmt.Printf("Headers: %v\n", httpRes.Header)
return nil, nil
}
// create a context with the response handler
ctx := context.Background()
ctx = context.WithValue(ctx, abstractions.ResponseHandlerOptionKey, responseHandler)
// execute the request
result, err := client.Teams().Post(ctx, requestBody, nil) |
Beta Was this translation helpful? Give feedback.
Hi @Maki079, thanks for highlighting such scenarios.
In cases where you would want to access the response header, you will need to define a response handler and define your serialization response.
Here is an example of the code