Skip to content

Commit

Permalink
feat: expose AbortError directly
Browse files Browse the repository at this point in the history
  • Loading branch information
timdp committed Mar 22, 2022
1 parent 361217d commit ed9d420
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,4 @@ fetch.Headers = Headers
fetch.Request = Request
fetch.Response = Response
fetch.FetchError = FetchError
fetch.AbortError = AbortError
6 changes: 4 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const TestServer = require('./fixtures/server.js')
const fetch = require('../lib/index.js')
const stringToArrayBuffer = require('string-to-arraybuffer')
const URLSearchParamsPolyfill = require('@ungap/url-search-params')
const { FetchError, Headers, Request, Response } = fetch
const { AbortError, FetchError, Headers, Request, Response } = fetch
const AbortErrorOrig = require('../lib/abort-error.js')
const FetchErrorOrig = require('../lib/fetch-error.js')
const HeadersOrig = require('../lib/headers.js')
const { createHeadersLenient } = HeadersOrig
Expand Down Expand Up @@ -80,7 +81,8 @@ t.test('return a promise', t => {
t.end()
})

t.test('expose Headers, Response and Request constructors', t => {
t.test('expose AbortError, FetchError, Headers, Response and Request constructors', t => {
t.equal(AbortError, AbortErrorOrig)
t.equal(FetchError, FetchErrorOrig)
t.equal(Headers, HeadersOrig)
t.equal(Response, ResponseOrig)
Expand Down

0 comments on commit ed9d420

Please sign in to comment.