@vonage/vetch
Advanced tools
Comparing version 0.1.0 to 0.2.0
import { VetchOptions } from './types'; | ||
import { Vetch } from './vetch'; | ||
export { VetchError, VetchPromise, VetchResponse, Headers, RetryConfig, ResponseTypes } from './types'; | ||
export { VetchError, VetchPromise, VetchResponse, Headers, ResponseTypes, } from './types'; | ||
export { Vetch, VetchOptions }; | ||
export declare const instance: Vetch; | ||
export declare function request<T>(opts: VetchOptions): Promise<import("./types").VetchResponse<T>>; |
@@ -53,3 +53,1 @@ export declare class VetchError extends Error { | ||
} | ||
export interface RetryConfig { | ||
} |
@@ -53,3 +53,3 @@ "use strict"; | ||
if (!opts.checkStatus(formattedResponse.status)) { | ||
let err = new types_1.VetchError(`Request failed with status code ${formattedResponse.status}`, opts); | ||
const err = new types_1.VetchError(`Request failed with status code ${formattedResponse.status}`, opts); | ||
err.code = String(formattedResponse.status); | ||
@@ -101,3 +101,3 @@ err.response = formattedResponse; | ||
} | ||
let prefix = opts.url.includes('?') ? '&' : '?'; | ||
const prefix = opts.url.includes('?') ? '&' : '?'; | ||
opts.url = `${opts.url}${prefix}${queryParams}`; | ||
@@ -114,4 +114,4 @@ } | ||
} | ||
if (!opts.headers['Accept'] && opts.responseType === 'json') { | ||
opts.headers['Accept'] = 'application/json'; | ||
if (!opts.headers.Accept && opts.responseType === 'json') { | ||
opts.headers.Accept = 'application/json'; | ||
} | ||
@@ -118,0 +118,0 @@ return opts; |
{ | ||
"name": "@vonage/vetch", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Vonage package for server side fetch.", | ||
@@ -14,3 +14,3 @@ "author": "Kelly J Andrews <kelly@kellyjandrews.com>", | ||
"publishConfig": { | ||
"directory": "dist" | ||
"directory": "dist" | ||
}, | ||
@@ -25,6 +25,9 @@ "repository": { | ||
"compile": "tsc -p tsconfig.json", | ||
"lerna": "../../node_modules/.bin/lerna", | ||
"prepare": "npm run build", | ||
"format": "prettier --write \"lib/**/*.ts\" \"__tests__/**/*.ts\"", | ||
"lint": "tslint -p tsconfig.json", | ||
"prepublishOnly": "npm run build && npm run test && npm run lint", | ||
"preversion": "npm run lint", | ||
"test-watch": "npx jest --watch", | ||
"test": "npx jest" | ||
"test": "npx jest", | ||
"version": "npm run format && git add -A lib" | ||
}, | ||
@@ -36,10 +39,12 @@ "bugs": { | ||
"lodash.merge": "^4.6.2", | ||
"node-fetch": "^2.6.1" | ||
"node-fetch": "^2.6" | ||
}, | ||
"gitHead": "b5818afa99349dec888eb9c7bc7c3ced3c10bece", | ||
"devDependencies": { | ||
"@types/lodash": "^4.14.172", | ||
"@types/node-fetch": "^2.5.12", | ||
"typescript": "^4.3.5" | ||
"@types/lodash": "^4.14.182", | ||
"prettier": "^2.7.1", | ||
"tslint": "^6.1.3", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^4.7.4" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12078
5
270
Updatednode-fetch@^2.6