Skip to content

Commit 44cc088

Browse files
authored
Merge pull request #129 from WhyThat/fix-fetch-method
fix method parameter for requestInit with rescript v11
2 parents 3a973a1 + 4fe2a55 commit 44cc088

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
1212
## main
1313

14+
# 0.9.1
15+
16+
#### :bug: Bug Fix
17+
18+
- Fix binding compatibility with ReScript 11, which removed `_` variable mangling. https://github.com/TheSpyder/rescript-webapi/pull/129
19+
1420
## 0.9.0
1521

1622
#### :boom: Breaking Change

src/Webapi/Webapi__Blob.res

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ module Impl = (
77

88
@get external size: T.t => float = "size"
99

10-
@send external slice: (T.t, ~start: int=?, ~end_: int=?, ~contentType: string=?, unit) => T.t = "slice"
10+
@send
11+
external slice: (T.t, ~start: int=?, ~end_: int=?, ~contentType: string=?, unit) => T.t = "slice"
1112

1213
@send external stream: T.t => Webapi__ReadableStream.t = "stream"
1314

@@ -27,7 +28,11 @@ type endingType = [#transparent | #native]
2728
type blobPropertyBag
2829

2930
@obj
30-
external makeBlobPropertyBag: (~_type: string=?, ~endings: endingType=?, unit) => blobPropertyBag = ""
31+
external makeBlobPropertyBag: (
32+
@as("type") ~_type: string=?,
33+
~endings: endingType=?,
34+
unit,
35+
) => blobPropertyBag = ""
3136

3237
type blobPart
3338

@@ -45,4 +50,4 @@ external int32ArrayToBlobPart: Js.Typed_array.Int32Array.t => blobPart = "%ident
4550
external uint32ArrayToBlobPart: Js.Typed_array.Uint32Array.t => blobPart = "%identity"
4651
external float32ToBlobPart: Js.Typed_array.Float32Array.t => blobPart = "%identity"
4752
external float64ArrayToBlobPart: Js.Typed_array.Float64Array.t => blobPart = "%identity"
48-
external dataViewToBlobPart: Js.Typed_array.DataView.t => blobPart = "%identity"
53+
external dataViewToBlobPart: Js.Typed_array.DataView.t => blobPart = "%identity"

src/Webapi/Webapi__Fetch.res

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ module RequestInit = {
309309

310310
@obj
311311
external make: (
312-
~_method: string=?,
312+
@as("method") ~_method: string=?,
313313
~headers: headersInit=?,
314314
~body: bodyInit=?,
315315
~referrer: string=?,
@@ -336,7 +336,7 @@ module RequestInit = {
336336
~integrity: string="",
337337
~keepalive: option<bool>=?,
338338
~signal: option<signal>=?,
339-
()
339+
(),
340340
) =>
341341
make(
342342
~_method=?map(encodeRequestMethod, method_),
@@ -351,7 +351,7 @@ module RequestInit = {
351351
~integrity,
352352
~keepalive?,
353353
~signal?,
354-
()
354+
(),
355355
)
356356
}
357357

@@ -403,7 +403,7 @@ module ResponseInit = {
403403
~status: option<int>=?,
404404
~statusText: option<string>=?,
405405
~headers: option<headersInit>=?,
406-
()
406+
(),
407407
) => make(~status?, ~statusText?, ~headers?, ())
408408
}
409409

@@ -436,4 +436,4 @@ module Response = {
436436
@val external fetch: string => Js.Promise.t<response> = "fetch"
437437
@val external fetchWithInit: (string, requestInit) => Js.Promise.t<response> = "fetch"
438438
@val external fetchWithRequest: request => Js.Promise.t<response> = "fetch"
439-
@val external fetchWithRequestInit: (request, requestInit) => Js.Promise.t<response> = "fetch"
439+
@val external fetchWithRequestInit: (request, requestInit) => Js.Promise.t<response> = "fetch"

src/Webapi/Webapi__File.res

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,21 @@ include Webapi__Blob.Impl({
66
type t = t
77
})
88

9-
109
type filePropertyBag
1110

1211
@obj
1312
external makeFilePropertyBag: (
1413
~endings: Webapi__Blob.endingType=?,
15-
~_type: string=?,
14+
@as("type") ~_type: string=?,
1615
~lastModified: float=?,
1716
unit,
1817
) => filePropertyBag = ""
1918

2019
@@text("{1 File class}")
2120

2221
@new external make: (array<Webapi__Blob.blobPart>, string) => t = "File"
23-
@new external makeWithOptions: (array<Webapi__Blob.blobPart>, string, filePropertyBag) => t = "File";
22+
@new external makeWithOptions: (array<Webapi__Blob.blobPart>, string, filePropertyBag) => t = "File"
2423

2524
@get external lastModified: t => float = "lastModified"
2625

27-
@get external name: t => string = "name"
26+
@get external name: t => string = "name"

0 commit comments

Comments
 (0)