File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -835,10 +835,6 @@ webidl.converters.RequestInfo = function (V) {
835835 return webidl . converters . USVString ( V )
836836}
837837
838- webidl . converters . AbortSignal = webidl . interfaceConverter (
839- AbortSignal
840- )
841-
842838// https://fetch.spec.whatwg.org/#requestinit
843839webidl . converters . RequestInit = webidl . dictionaryConverter ( [
844840 {
@@ -913,9 +909,7 @@ webidl.converters.RequestInit = webidl.dictionaryConverter([
913909 } ,
914910 {
915911 key : 'signal' ,
916- converter : webidl . nullableConverter (
917- webidl . converters . AbortSignal
918- )
912+ converter : webidl . converters . any
919913 } ,
920914 {
921915 key : 'window' ,
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ const { once } = require('events')
77const { ReadableStream } = require ( 'stream/web' )
88const { DOMException } = require ( '../../lib/fetch/constants' )
99
10+ const { AbortController : NPMAbortController } = require ( 'abort-controller' )
11+
1012/* global AbortController */
1113
1214test ( 'parallel fetch with the same AbortController works as expected' , async ( t ) => {
@@ -106,3 +108,31 @@ test('Readable stream synchronously cancels with AbortError if aborted before re
106108
107109 t . end ( )
108110} )
111+
112+ test ( 'Allow the usage of custom implementation of AbortController' , async ( t ) => {
113+ const body = {
114+ fixes : 1605
115+ }
116+
117+ const server = createServer ( ( req , res ) => {
118+ res . statusCode = 200
119+ res . end ( JSON . stringify ( body ) )
120+ } )
121+
122+ t . teardown ( server . close . bind ( server ) )
123+
124+ server . listen ( 0 )
125+ await once ( server , 'listening' )
126+
127+ const controller = new NPMAbortController ( )
128+ const signal = controller . signal
129+ controller . abort ( )
130+
131+ try {
132+ await fetch ( `http://localhost:${ server . address ( ) . port } ` , {
133+ signal
134+ } )
135+ } catch ( e ) {
136+ t . equal ( e . code , DOMException . ABORT_ERR )
137+ }
138+ } )
You can’t perform that action at this time.
0 commit comments