From c04106b2769cc71345bfd3d56429ccac03e25ed7 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 14 May 2026 21:45:00 +0200 Subject: [PATCH] Add ToRequestBody Blob instance Lets fetch `body: someBlob` work without coercing through one of the existing constructors. Pairs with the corresponding `fromBlob` in purescript-js-fetch. --- src/Fetch/Internal/RequestBody.purs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Fetch/Internal/RequestBody.purs b/src/Fetch/Internal/RequestBody.purs index ab57782..510cd19 100644 --- a/src/Fetch/Internal/RequestBody.purs +++ b/src/Fetch/Internal/RequestBody.purs @@ -2,6 +2,7 @@ module Fetch.Internal.RequestBody where import Data.ArrayBuffer.Types (ArrayBuffer, ArrayView, Uint8Array) import JS.Fetch.RequestBody as CoreRequestBody +import Web.File.Blob (Blob) import Web.Streams.ReadableStream (ReadableStream) class ToRequestBody body where @@ -13,6 +14,9 @@ instance ToRequestBody ArrayBuffer where instance ToRequestBody (ArrayView a) where toRequestBody = CoreRequestBody.fromArrayView +instance ToRequestBody Blob where + toRequestBody = CoreRequestBody.fromBlob + instance ToRequestBody String where toRequestBody = CoreRequestBody.fromString