HttpMethodOverrider

org.http4s.server.middleware.HttpMethodOverrider$

Attributes

Source:
HttpMethodOverrider.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Type members

Classlikes

Attributes

Source:
HttpMethodOverrider.scala
Graph
Supertypes
trait Product
trait Equals
trait OverrideStrategy[F, G]
class Object
trait Matchable
class Any
final case class HeaderOverrideStrategy[F[_], G[_]](headerName: CIString) extends OverrideStrategy[F, G]

Attributes

Source:
HttpMethodOverrider.scala
Graph
Supertypes
trait Product
trait Equals
trait OverrideStrategy[F, G]
class Object
trait Matchable
class Any

HttpMethodOverrider middleware config options.

HttpMethodOverrider middleware config options.

Attributes

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

Attributes

Companion:
class
Source:
HttpMethodOverrider.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait OverrideStrategy[F[_], G[_]]

Attributes

Source:
HttpMethodOverrider.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
final case class QueryOverrideStrategy[F[_], G[_]](paramName: String) extends OverrideStrategy[F, G]

Attributes

Source:
HttpMethodOverrider.scala
Graph
Supertypes
trait Product
trait Equals
trait OverrideStrategy[F, G]
class Object
trait Matchable
class Any

Value members

Concrete methods

def valupdatedVaryHeader:Raw=`resp₂`.headers.get(varyHeaderName).map[Raw](((_$17:NonEmptyList[Raw])=>_$17.head)).map[Raw](((h:Header.Raw)=>Header.Raw.apply(h.name,_root_.scala.StringContext.apply("",",","").s(h.value,headerName.toString)))).getOrElse[Raw](Header.Raw.apply(varyHeaderName,headerName.toString)) `resp₂`.withHeaders(`resp₂`.headers.put(rawToRaw(updatedVaryHeader))) case_=> `resp₂` } } defupdateRequestWithMethod(`req₂`:Request[G],`om₂`:Method):Request[G]={ valattrs:Vault=`req₂`.attributes.insert[Method](overriddenMethodAttrKey,`req₂`.method) `req₂`.withAttributes(attrs).withMethod(`om₂`) } defgetUnsafeOverrideMethod(`req₃`:Request[G]):F[Option[String]]=config.overrideStrategymatch{ caseHeaderOverrideStrategy(headerName)=> F.pure[Option[String]](`req₃`.headers.get(`headerName₂`).map[String](((_$18:NonEmptyList[Raw])=>_$18.head.value))) caseQueryOverrideStrategy(parameter)=> F.pure[Option[String]](`req₃`.params.get(parameter)) caseFormOverrideStrategy(field,f)=> toFunctorOps[F,Option[Map[String,Chain[String]]]](f.apply[Option[Map[String,Chain[String]]]](toFunctorOps[G,Either[DecodeFailure,UrlForm]](UrlForm.entityDecoder[G](F=S,UrlForm.entityDecoder$default$2[G]).decode(`req₃`,strict=true).value)(S).map[Option[Map[String,Chain[String]]]](((_$19:Either[DecodeFailure,UrlForm])=>_$19.toOption.map[Map[String,Chain[String]]](((_$20:UrlForm)=>_$20.values))))))(F).map[Option[String]](((formFields:Option[Map[String,Chain[String]]])=>formFields.flatMap[String](((_$21:Map[String,Chain[String]])=>_$21.get(field).flatMap[String](((_$22:Chain[String])=>_$22.uncons.map[String](((_$23:Tuple2[String,Chain[String]])=>_$23._1)))))))) } defprocessRequest(`req₄`:Request[G]):F[Response[G]]=toFlatMapOps[F,Option[String]](getUnsafeOverrideMethod(`req₄`))(F).flatMap[Response[G]](((x$1:Option[String])=>x$1match{ caseSome(m:String)=> parseMethod.andThen[F[Response[G]]](((_$24:ParseResult[Method])=>processRequestWithMethod(`req₄`,_$24))).apply(`m₂`) caseNone=> http.apply(`req₄`) })) Kleisli.apply[F,Request[G],Response[G]](((`req₅`:Request[G])=>{ valisOverridden:Boolean=config.overridableMethods.contains(`req₅`.method) if(isOverridden)processRequest(`req₅`)elsehttp.apply(`req₅`) })) }" t="n"class="documentableName ">apply[F[_], G[_]](http: Http[F, G], config: HttpMethodOverriderConfig[F, G])(implicit F: Monad[F], S: Concurrent[G]): Http[F, G]

Simple middleware for HTTP Method Override.

Simple middleware for HTTP Method Override.

This middleware lets you use HTTP verbs such as PUT or DELETE in places where the client doesn't support it. Camouflage your request with another HTTP verb(usually POST) and sneak the desired one using a custom header or request parameter. The middleware will '''override''' the original verb with the new one for you, allowing the request the be dispatched properly.

Attributes

config

http method overrider config

http

Http to transform

Source:
HttpMethodOverrider.scala

Concrete fields