MCPcopy Index your code
hub / github.com/NdoleStudio/httpsms / newResponse

Method newResponse

api/pkg/discord/client.go:108–123  ·  view source on GitHub ↗

newResponse converts an *http.Response to *Response

(httpResponse *http.Response)

Source from the content-addressed store, hash-verified

106
107// newResponse converts an *http.Response to *Response
108func (client *Client) newResponse(httpResponse *http.Response) (*Response, error) {
109 if httpResponse == nil {
110 return nil, fmt.Errorf("%T cannot be nil", httpResponse)
111 }
112
113 resp := new(Response)
114 resp.HTTPResponse = httpResponse
115
116 buf, err := io.ReadAll(resp.HTTPResponse.Body)
117 if err != nil {
118 return nil, err
119 }
120 resp.Body = &buf
121
122 return resp, resp.Error()
123}

Callers 1

doMethod · 0.95

Calls 1

ErrorMethod · 0.65

Tested by

no test coverage detected