MCPcopy Index your code
hub / github.com/slackapi/node-slack-sdk / buildResult

Method buildResult

packages/web-api/src/WebClient.ts:714–737  ·  view source on GitHub ↗

* Processes an HTTP response into a WebAPICallResult by performing JSON parsing on the body and merging relevent * HTTP headers into the object. * @param response - an http response

(response: AxiosResponse)

Source from the content-addressed store, hash-verified

712 * @param response - an http response
713 */
714 private buildResult(response: AxiosResponse): WebAPICallResult {
715 const data = response.data;
716
717 if (data.response_metadata === undefined) {
718 data.response_metadata = {};
719 }
720
721 // add scopes metadata from headers
722 if (response.headers['x-oauth-scopes'] !== undefined) {
723 data.response_metadata.scopes = (response.headers['x-oauth-scopes'] as string).trim().split(/\s*,\s*/);
724 }
725 if (response.headers['x-accepted-oauth-scopes'] !== undefined) {
726 data.response_metadata.acceptedScopes =
727 (response.headers['x-accepted-oauth-scopes'] as string).trim().split(/\s*,\s*/);
728 }
729
730 // add retry metadata from headers
731 const retrySec = parseRetryHeaders(response);
732 if (retrySec !== undefined) {
733 data.response_metadata.retryAfter = retrySec;
734 }
735
736 return data;
737 }
738}
739
740export default WebClient;

Callers 1

apiCallMethod · 0.95

Calls 1

parseRetryHeadersFunction · 0.85

Tested by

no test coverage detected