All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.laminext.fetch.ToRequestBody.scala Maven / Gradle / Ivy

There is a newer version: 0.17.0
Show newest version
package io.laminext.fetch

import org.scalajs.dom
import scala.scalajs.js

trait ToRequestBody {

  def apply(): js.UndefOr[dom.BodyInit]
  def updateHeaders(headers: js.UndefOr[Map[String, String]]): js.UndefOr[Map[String, String]] = headers

}

object ToRequestBody {

  val noBody: ToRequestBody = () => js.undefined

  implicit def blobRequestBody(blob: dom.Blob): ToRequestBody = () => blob

  implicit def bufferSourceRequestBody(bufferSource: dom.BufferSource): ToRequestBody = () => bufferSource

  implicit def formDataRequestBody(formData: dom.FormData): ToRequestBody = () => formData

  implicit def stringRequestBody(string: String): ToRequestBody = () => string

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy