StrictForm

org.apache.pekko.http.scaladsl.common.StrictForm
See theStrictForm companion object
sealed abstract class StrictForm

Read-only abstraction on top of application/x-www-form-urlencoded and multipart form data, allowing joint unmarshalling access to either kind, if you supply both, a pekko.http.scaladsl.unmarshalling.FromStringUnmarshaller as well as a pekko.http.scaladsl.unmarshalling.FromEntityUnmarshaller for the target type T. Note: In order to allow for random access to the field values streamed multipart form data are strictified! Don't use this abstraction on potentially unbounded forms (e.g. large file uploads).

If you only need to consume one type of form (application/x-www-form-urlencoded or multipart) then simply unmarshal directly to the respective form abstraction (pekko.http.scaladsl.model.FormData or pekko.http.scaladsl.model.Multipart.FormData) rather than going through StrictForm.

Simple usage example:

val strictFormFuture = Unmarshal(entity).to[StrictForm]
val fooFieldUnmarshalled: Future[T] =
 strictFormFuture flatMap { form =>
   Unmarshal(form field "foo").to[T]
 }

Attributes

Companion
object
Source
StrictForm.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def fields: Seq[(String, Field)]

Attributes

Source
StrictForm.scala

Concrete methods

def field(name: String): Option[Field]

Attributes

Source
StrictForm.scala