MCPcopy Create free account
hub / github.com/GetStream/stream-js / enrichKwargs

Method enrichKwargs

src/client.ts:625–643  ·  view source on GitHub ↗

* Adds the API key and the token * @method enrichKwargs * @private * @memberof StreamClient.prototype * @param {AxiosConfig} kwargs * @return {axios.AxiosRequestConfig}

({ method, token, ...kwargs }: AxiosConfig & { method: axios.Method })

Source from the content-addressed store, hash-verified

623 * @return {axios.AxiosRequestConfig}
624 */
625 enrichKwargs({ method, token, ...kwargs }: AxiosConfig & { method: axios.Method }): axios.AxiosRequestConfig {
626 return {
627 method,
628 url: this.enrichUrl(kwargs.url, kwargs.serviceName),
629 data: kwargs.body,
630 params: {
631 api_key: this.apiKey,
632 location: this.group,
633 ...(kwargs.qs || {}),
634 },
635 headers: {
636 'X-Stream-Client': this.userAgent(),
637 'stream-auth-type': 'jwt',
638 Authorization: token,
639 ...(kwargs.headers || {}),
640 },
641 ...(kwargs.axiosOptions || {}),
642 };
643 }
644
645 /**
646 * Get the authorization middleware to use Faye with getstream.io

Callers 2

StreamClientClass · 0.95
client_test.jsFile · 0.80

Calls 2

enrichUrlMethod · 0.95
userAgentMethod · 0.95

Tested by

no test coverage detected