Skip to content

Commit

Permalink
refactor: add xhr in transformResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
askuzminov committed Mar 25, 2021
1 parent 8124b1f commit 105fdc1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/http/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export const grpcHTTP = ({

return data;
})
.then(data => (isFunction(transformResponse) ? transformResponse({ data }) : data))
.then(data => (isFunction(transformResponse) ? transformResponse({ xhr, data }) : data))
.catch(data => {
logger?.error(method, data);
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
Expand Down
2 changes: 1 addition & 1 deletion src/http/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export interface ConfigGRPC {
info: LoggerFn;
};
transformRequest?<T>(params: { xhr: XMLHttpRequest; data: T }): T | void | Promise<T | void>;
transformResponse?<T>(params: { data: GOutput<T> }): GOutput<T> | Promise<GOutput<T>>;
transformResponse?<T>(params: { xhr: XMLHttpRequest; data: GOutput<T> }): GOutput<T> | Promise<GOutput<T>>;
}

export interface Cancel {
Expand Down

0 comments on commit 105fdc1

Please sign in to comment.