From 7e19aa7714008e8b666bb200090d15299e6a4fcf Mon Sep 17 00:00:00 2001 From: digitalAlchemist Date: Tue, 29 Oct 2019 12:19:20 +0000 Subject: [PATCH 1/2] Moving request const, using form.getHeaders to populate request --- lib/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index ca769780..23de82b8 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -38,8 +38,6 @@ type File = string | Buffer | Readable; * Creates a function to be used for finding potential sources for a given image. */ const sagiri = (token: string, defaultOptions: Options = { results: 5 }) => { - const request = bent('https://saucenao.com', 'json', 'POST'); - log('Created Sagiri function with default options:', defaultOptions); return async ( @@ -100,6 +98,14 @@ const sagiri = (token: string, defaultOptions: Options = { results: 5 }) => { form.append('file', file); } + const request = bent( + 'https://saucenao.com', + 'json', + 'POST', + 200, + form.getHeaders() + ); + log('Sending request to SauceNAO'); const response = (await request('/search.php', form)) as Response; From 4f730c5d1ddf778f625857dd4c54bf6a3186c074 Mon Sep 17 00:00:00 2001 From: digitalAlchemist Date: Tue, 29 Oct 2019 12:21:20 +0000 Subject: [PATCH 2/2] Updating semver --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 30c73805..4ee43f7c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sagiri", - "version": "3.0.0", + "version": "3.0.1", "description": "A simple, lightweight and actually good JS wrapper for the SauceNAO API.", "author": "sr229", "license": "MIT",