Skip to content

Commit

Permalink
Switch to fetch-h2
Browse files Browse the repository at this point in the history
  • Loading branch information
myrotvorets-team committed Dec 13, 2021
1 parent 8deb018 commit 1a8e6d6
Show file tree
Hide file tree
Showing 4 changed files with 932 additions and 1,028 deletions.
4 changes: 2 additions & 2 deletions lib/index.ts
@@ -1,4 +1,4 @@
import fetch, { Response } from 'node-fetch';
import { Response, fetch } from 'fetch-h2';
import { FaceXError, HttpError, IRemoteTransport, NetworkError } from '@myrotvorets/facex-base';

export class TransportFetch implements IRemoteTransport {
Expand All @@ -21,7 +21,7 @@ export class TransportFetch implements IRemoteTransport {
}

private static _fetch(url: URL, body: string, headers: Record<string, string>): Promise<Response> {
return fetch(url, { method: 'POST', body, headers }).catch((e: Error) => {
return fetch(url.toString(), { method: 'POST', body, headers }).catch((e: Error) => {
throw new NetworkError(e.message);
});
}
Expand Down

0 comments on commit 1a8e6d6

Please sign in to comment.