File tree 2 files changed +31
-7
lines changed 2 files changed +31
-7
lines changed Original file line number Diff line number Diff line change @@ -835,10 +835,6 @@ webidl.converters.RequestInfo = function (V) {
835
835
return webidl . converters . USVString ( V )
836
836
}
837
837
838
- webidl . converters . AbortSignal = webidl . interfaceConverter (
839
- AbortSignal
840
- )
841
-
842
838
// https://fetch.spec.whatwg.org/#requestinit
843
839
webidl . converters . RequestInit = webidl . dictionaryConverter ( [
844
840
{
@@ -913,9 +909,7 @@ webidl.converters.RequestInit = webidl.dictionaryConverter([
913
909
} ,
914
910
{
915
911
key : 'signal' ,
916
- converter : webidl . nullableConverter (
917
- webidl . converters . AbortSignal
918
- )
912
+ converter : webidl . converters . any
919
913
} ,
920
914
{
921
915
key : 'window' ,
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ const { once } = require('events')
7
7
const { ReadableStream } = require ( 'stream/web' )
8
8
const { DOMException } = require ( '../../lib/fetch/constants' )
9
9
10
+ const { AbortController : NPMAbortController } = require ( 'abort-controller' )
11
+
10
12
/* global AbortController */
11
13
12
14
test ( '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
106
108
107
109
t . end ( )
108
110
} )
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