File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Sources/ECMASwift/API/Fetch Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ public final class FetchAPI {
6161 return
6262 }
6363 // options can include body.
64- if let options, options. hasProperty ( " body " ) {
64+ if let options, options. hasValue , options . hasProperty ( " body " ) {
6565 request. httpBody = options. forProperty ( " body " ) . toString ( ) . data ( using: . utf8)
6666 }
6767 guard let client = self ? . client else { return }
@@ -89,11 +89,13 @@ public final class FetchAPI {
8989 return
9090 }
9191 }
92- if let signal = options? . forProperty ( " signal " ) . toType ( AbortSignal . self) {
93- signal. onAbort = {
94- if signal. aborted {
95- fetchTask? . cancel ( )
96- reject. call ( withArguments: [ [ " name " : " AbortError " ] ] )
92+ if let options = options, options. hasValue {
93+ if let signal = options. forProperty ( " signal " ) . toType ( AbortSignal . self) {
94+ signal. onAbort = {
95+ if signal. aborted {
96+ fetchTask? . cancel ( )
97+ reject. call ( withArguments: [ [ " name " : " AbortError " ] ] )
98+ }
9799 }
98100 }
99101 }
You can’t perform that action at this time.
0 commit comments