@beyonk/http 12.0.0 → 12.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.MD CHANGED
@@ -188,9 +188,7 @@ Handlers have a signature with two items:
188
188
  ```js
189
189
  .badData((e, ctx) => {
190
190
  console.error('Bad data', e)
191
- ctx.redirect('/foo/bar')
192
- // or
193
- ctx.error('/foo/bar')
191
+ throw redirect('/foo/bar')
194
192
  })
195
193
  ```
196
194
 
@@ -201,7 +199,7 @@ However, if the `context` object you pass in has a `fetch` function, this is use
201
199
  ```js
202
200
  export async function preload () {
203
201
  await Api
204
- .context(this) // fetch, redirect, error.
202
+ .context({ fetch })
205
203
  .endpoint('foo/bar')
206
204
  ...
207
205
  }
@@ -232,7 +230,7 @@ Names are the same as the local handlers:
232
230
  baseUrl: 'https://example.com/your/api/base',
233
231
  handlers: {
234
232
  paymentRequired(e => {
235
- redirect(307, '/checkout')
233
+ throw redirect(307, '/checkout')
236
234
  })
237
235
  }
238
236
  })
package/lib/api/index.js CHANGED
@@ -10,6 +10,7 @@ import { PreconditionFailedMixin } from '../error-handlers/precondition-failed.j
10
10
  import { TooManyRequestsMixin } from '../error-handlers/too-many-requests.js'
11
11
  import { NotAcceptableMixin } from '../error-handlers/not-acceptable.js'
12
12
  import { GoneMixin } from '../error-handlers/gone.js'
13
+ import { ExpectationFailedMixin } from '../error-handlers/expectation-failed.js'
13
14
  import { byCode } from '../errors.js'
14
15
  import { compose } from './_just-compose.js'
15
16
 
@@ -26,7 +27,8 @@ const Behaviours = compose(
26
27
  PreconditionFailedMixin,
27
28
  TooManyRequestsMixin,
28
29
  NotAcceptableMixin,
29
- GoneMixin
30
+ GoneMixin,
31
+ ExpectationFailedMixin
30
32
  )(ApiBase)
31
33
 
32
34
  class Api extends Behaviours {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beyonk/http",
3
- "version": "12.0.0",
3
+ "version": "12.0.1",
4
4
  "description": "An isomorphic http client for Svelte apps",
5
5
  "main": "lib/entrypoint.js",
6
6
  "module": "lib/entrypoint.js",