trait
ResponseHandlerDSL extends AnyRef
Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Inherited from AnyRef
Inherited from Any
Facilitates the handling of various response codes per response, where each handler for a given code may fail or may succeed with a value of some type
Success
or fail with a value of some typeFailure
.Failure
must have an implicit conversion from Throwable in scope, and defaults to Throwable.ResponseHandler
is an immutable wrapper; handlers, aHTTPResponse => Validation[Failure,Success]. can be added by using handleCode
, which returns a new instance. After all desired handlers have been added callingtoIO
or using the implicit provided in com.stackmob.newman.dsl will return anIO[Validation[Failure,Success]
.For response codes without a "catchall" handler always
scalaz.Failure
with a com.stackmob.newman.dsl.UnhandledResponseCode as its value.To begin using
ResponseHandler
call com.stackmob.newman.request.HttpRequest'sprepare
method and then begin changing calls tohandleCode
.Example:
If the response is expected to be considered a success when it its code is
200 OK
and is expected to have a body whose content can is valid JSONexpectJSONBody
can be called given there is an implicitnet.liftweb.json.scalaz.Types.JSONR
in scope forT
. SeeexpectJSONBody
for more info.Example:
If the response is expected to be considered a success when it its code is
204 No Content
,expectNoContent(t: T)
can be called to return ascalaz.Success
when theIO
is performed. SeeexpectNoContent
for more info.