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

spice.http.content.FormDataEntry.scala Maven / Gradle / Ivy

There is a newer version: 0.7.2
Show newest version
package spice.http.content

import fabric.Json
import fabric.io.JsonFormatter

import java.io.File
import spice.http.Headers
import spice.net.ContentType

sealed trait FormDataEntry {
  def headers: Headers
}

object FormDataEntry {
  case class FileEntry(fileName: String, file: File, headers: Headers) extends FormDataEntry
  case class StringEntry(value: String, headers: Headers) extends FormDataEntry
  def JsonEntry(value: Json, headers: Headers): FormDataEntry = StringEntry(
    value = JsonFormatter.Default(value),
    headers = headers.withHeader(Headers.`Content-Type`(ContentType.`application/json`))
  )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy