Skip to content

Post new Team response headers #637

Answered by rkodev
Maki079 asked this question in Q&A
Discussion options

You must be logged in to vote

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

	// 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, responseHa…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Maki079
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants