@nuxt/http
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -5,2 +5,16 @@ # Changelog | ||
## [0.5.0](https://github.com/nuxt/http/compare/v0.4.0...v0.5.0) (2020-04-13) | ||
### Features | ||
* add create helper and improve docs ([e37358f](https://github.com/nuxt/http/commit/e37358f5b2b6eb0c563ed5e85ce915faf9e3f168)) | ||
### Bug Fixes | ||
* rename with-config to enable testing ([b1a91cb](https://github.com/nuxt/http/commit/b1a91cbe9327cbc337ec1b822d0fdf9f75119c73)) | ||
* test failing ([255d8a1](https://github.com/nuxt/http/commit/255d8a17601ef77b3c875d0367b5fbad153dbc3c)) | ||
* **types:** update types for `HTTPError` to `ky.HTTPError` ([#91](https://github.com/nuxt/http/issues/91)) ([3a9100f](https://github.com/nuxt/http/commit/3a9100f2fe5978a537bf6d7cd40206572a487dd4)), closes [sindresorhus/ky#241](https://github.com/sindresorhus/ky/issues/241) | ||
## [0.4.0](https://github.com/nuxt/http/compare/v0.3.9...v0.4.0) (2020-03-27) | ||
@@ -7,0 +21,0 @@ |
@@ -104,3 +104,3 @@ const path = require('path') | ||
// transpile only for non-modern build | ||
// istanbul ignore if | ||
/* istanbul ignore next */ | ||
if (semver.gte(semver.coerce(this.nuxt.constructor.version), '2.9.0')) { | ||
@@ -107,0 +107,0 @@ this.options.build.transpile.push(({ isLegacy }) => isLegacy && 'ky') |
import KY from 'ky-universal' | ||
import defu from 'defu' | ||
@@ -13,2 +14,7 @@ class HTTP { | ||
setBaseURL (baseURL) { | ||
this._defaults.prefixUrl = baseURL | ||
} | ||
setHeader(name, value) { | ||
@@ -49,2 +55,8 @@ if (!value) { | ||
} | ||
create(options) { | ||
const { retry, timeout, prefixUrl, headers } = this._defaults | ||
return new HTTP(defu(options, { retry, timeout, prefixUrl, headers })) | ||
} | ||
} | ||
@@ -51,0 +63,0 @@ |
{ | ||
"name": "@nuxt/http", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Universal HTTP Module for Nuxt.js", | ||
"repository": "nuxt/http", | ||
"license": "MIT", | ||
@@ -9,16 +10,12 @@ "author": "Pooya Parsa <pooya@pi0.ir>", | ||
"types": "types/index.d.ts", | ||
"repository": "nuxt/http", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"files": [ | ||
"lib", | ||
"types/*.d.ts" | ||
], | ||
"scripts": { | ||
"dev": "nuxt test/fixture", | ||
"lint": "eslint lib test", | ||
"test": "yarn lint && jest", | ||
"release": "yarn test && standard-version && git push --follow-tags && npm publish" | ||
"release": "yarn test && standard-version && git push --follow-tags && npm publish", | ||
"test": "yarn lint && jest -i" | ||
}, | ||
"files": [ | ||
"lib", | ||
"types/*.d.ts" | ||
], | ||
"dependencies": { | ||
@@ -49,4 +46,6 @@ "@nuxtjs/proxy": "^1.3.3", | ||
"nuxt-edge": "latest", | ||
"standard-version": "latest" | ||
"puppeteer": "latest", | ||
"standard-version": "latest", | ||
"tib": "latest" | ||
} | ||
} |
import Vue from 'vue' | ||
import { ResponsePromise, Options, BeforeRequestHook, BeforeRetryHook, AfterResponseHook, HTTPError } from 'ky' | ||
import ky, { ResponsePromise, Options, BeforeRequestHook, BeforeRetryHook, AfterResponseHook } from 'ky' | ||
import './vuex' | ||
@@ -148,3 +148,3 @@ | ||
*/ | ||
onError(hook: (error: HTTPError) => void): void | ||
onError(hook: (error: ky.HTTPError) => void): void | ||
} | ||
@@ -151,0 +151,0 @@ |
21170
360
20