diff --git a/package.json b/package.json index 4dc6e41..ce08b5a 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@types/node": "^18.15.11" }, "dependencies": { - "@pushrocks/smartrequest": "^2.0.11", + "@pushrocks/smartrequest": "^2.0.15", "@pushrocks/smarturl": "^3.0.6", "tldts": "^6.0.3", "whoiser": "^1.16.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e7020fe..4819b8d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2,8 +2,8 @@ lockfileVersion: '6.0' dependencies: '@pushrocks/smartrequest': - specifier: ^2.0.11 - version: 2.0.11 + specifier: ^2.0.15 + version: 2.0.15 '@pushrocks/smarturl': specifier: ^3.0.6 version: 3.0.6 @@ -479,7 +479,7 @@ packages: '@pushrocks/smartmime': 1.0.5 '@pushrocks/smartpath': 5.0.5 '@pushrocks/smartpromise': 3.1.7 - '@pushrocks/smartrequest': 2.0.11 + '@pushrocks/smartrequest': 2.0.15 '@pushrocks/smartsitemap': 2.0.1 '@pushrocks/smarttime': 4.0.1 '@tsclass/tsclass': 4.0.34 @@ -520,7 +520,7 @@ packages: '@pushrocks/smartmime': 1.0.5 '@pushrocks/smartpath': 5.0.5 '@pushrocks/smartpromise': 3.1.7 - '@pushrocks/smartrequest': 2.0.11 + '@pushrocks/smartrequest': 2.0.15 '@pushrocks/smartstream': 2.0.3 '@pushrocks/streamfunction': 4.0.4 '@types/fs-extra': 11.0.1 @@ -677,6 +677,10 @@ packages: /@pushrocks/smartpromise@3.1.7: resolution: {integrity: sha512-2gLQCeviEJwZ+cHHtK2Ks98brZatGC6dPXKIs1tVgJsiNgRFjnp90fESuJ1Pmoe7RrS+7J3mO4NtsFHAJJ/y5w==} + dev: true + + /@pushrocks/smartpromise@4.0.2: + resolution: {integrity: sha512-bqorOaGXPOuiOSV81luTKrTghg4O4NBRD0zyv7TIqmrMGf4a0uoozaUMp1X8vQdZW+y0gTzUJP9wkzAE6Cci0g==} /@pushrocks/smartpuppeteer@2.0.2: resolution: {integrity: sha512-l3tqnD6Evseofq1avHsMy2FXXEmCd4Z+nm3xmMWS7nWvP9qTbJIn0XguOBaUIAhR8zE53UKPXs5/qBqXVNZDDQ==} @@ -692,10 +696,10 @@ packages: - utf-8-validate dev: true - /@pushrocks/smartrequest@2.0.11: - resolution: {integrity: sha512-fqS5D+o4fzhen4qlhT8DJiSSUVno1q+hSXcq5VJFGTQVtvaZ5lZeK1odqMJsCOHZ3mD2LykrufIPViktwgnyVg==} + /@pushrocks/smartrequest@2.0.15: + resolution: {integrity: sha512-QDXXKhOwAIp+TNFrDglApBpbCTClHrf8pUM3w81q5+VtrMbqUrLINHhInXt3ZUSgTS7RD9HtJSIVSqAukcJo5A==} dependencies: - '@pushrocks/smartpromise': 3.1.7 + '@pushrocks/smartpromise': 4.0.2 '@pushrocks/smarturl': 3.0.6 agentkeepalive: 4.3.0 form-data: 4.0.0 diff --git a/test/test.ts b/test/test.ts index 3bdce92..45c0923 100644 --- a/test/test.ts +++ b/test/test.ts @@ -13,6 +13,11 @@ tap.test('should get a parsed url result for whois', async () => { console.log(parsedUrlResult); }); +tap.test('should get additional data', async () => { + const parsedUrlResult = await testSmartWhois.getAdditionalWhoisDataForDomain('https://coffee.link/understanding-gen-z/'); + console.log(parsedUrlResult); +}); + tap.test('should get whois info for domain', async () => { const whoisInfo = await testSmartWhois.getWhoisForDomain('task.vc'); console.log(whoisInfo); diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index b98e40e..7cfbe27 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@pushrocks/smartwhois', - version: '1.0.8', + version: '1.0.9', description: 'a package for dealing with whois requests' } diff --git a/ts/index.ts b/ts/index.ts index 3450fa8..2e65659 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -53,6 +53,27 @@ export class SmartWhois { } } + public async getAdditionalWhoisDataForDomain(domainArg: string) { + if (domainArg.includes('//')) { + const parsedUrlResult = await this.getParsedUrlResultForWhois(domainArg); + domainArg = parsedUrlResult.fullDomain; + } + + // lets test http response + const httpResult = await plugins.smartrequest.safeGet(`http://${domainArg}/`); + + // lets test https response + const httpsResult = await plugins.smartrequest.safeGet(`https://${domainArg}/`); + + return { + httpStatus: httpResult.statusCode, + httpsStatus: httpsResult.statusCode, + httpContentType: httpResult.headers['content-type'], + httpsContentType: httpsResult.headers['content-type'], + } + + } + public async getWhoisForDomain(domainArg: string): Promise { if (domainArg.includes('//')) { diff --git a/ts/smartwhois.plugins.ts b/ts/smartwhois.plugins.ts index 6a28d9d..a020108 100644 --- a/ts/smartwhois.plugins.ts +++ b/ts/smartwhois.plugins.ts @@ -1,8 +1,10 @@ // pushrocks scope import * as smarturl from '@pushrocks/smarturl'; +import * as smartrequest from '@pushrocks/smartrequest'; export { smarturl, + smartrequest, } // third party