diff --git a/api/package.json b/api/package.json index 8043fbd..673005f 100644 --- a/api/package.json +++ b/api/package.json @@ -8,7 +8,7 @@ "test": "jest --coverage" }, "dependencies": { - "isomorphic-unfetch": "^3.0.0", + "node-fetch": "^2.6.0", "npm-name": "^5.5.0", "whois-json": "^2.0.4" }, diff --git a/api/services/domain.ts b/api/services/domain.ts index ba3a32c..c556daa 100644 --- a/api/services/domain.ts +++ b/api/services/domain.ts @@ -16,9 +16,6 @@ export default async function handler( const availability = response[0].data.domainName ? false : true; send(res, {availability}); } catch (err) { - if (err.code === 'ENOTFOUND') { - return send(res, {availability: true}); - } sendError(res, err); } } diff --git a/api/util/http.ts b/api/util/http.ts index 516c94b..9bbe8db 100644 --- a/api/util/http.ts +++ b/api/util/http.ts @@ -1,4 +1,4 @@ -import nodeFetch from 'isomorphic-unfetch'; +import nodeFetch, {Response} from 'node-fetch'; export type HttpMethod = | 'GET' @@ -21,15 +21,18 @@ export interface NowResponse { length: number; } -export function fetch(url: string, method: HttpMethod = 'HEAD') { +export function fetch( + url: string, + method: HttpMethod = 'HEAD', +): Promise { return nodeFetch(url, {method: method}); } -export function send(res: NowResponse, data: object) { +export function send(res: NowResponse, data: object): void { res.setHeader('Cache-Control', 's-maxage=86400'); res.json(data); } -export function sendError(res: NowResponse, error: Error) { +export function sendError(res: NowResponse, error: Error): void { res.status(400).json({error: error.message}); } diff --git a/api/util/testHelpers.ts b/api/util/testHelpers.ts index 1219a66..29f7f29 100644 --- a/api/util/testHelpers.ts +++ b/api/util/testHelpers.ts @@ -1,4 +1,7 @@ -export async function mockProvider(provider: any, query: any) { +export async function mockProvider( + provider: any, + query: unknown, +): Promise { const req = { query, }; diff --git a/web/src/util/zones.ts b/web/src/util/zones.ts index 54ef26e..c0aaeab 100644 --- a/web/src/util/zones.ts +++ b/web/src/util/zones.ts @@ -552,7 +552,6 @@ export const zones = [ 'gcc', 'gd', 'gdn', - 'ge', 'gea', 'gecompany', 'ged', diff --git a/yarn.lock b/yarn.lock index e8266a1..ee4e133 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7608,7 +7608,7 @@ nock@^11.7.2: mkdirp "^0.5.0" propagate "^2.0.0" -node-fetch@^2.1.2, node-fetch@^2.2.0: +node-fetch@^2.1.2, node-fetch@^2.2.0, node-fetch@^2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==