Object/Trait

org.iainhull.resttest

Api

Related Docs: trait Api | package resttest

Permalink

object Api

Provides the main api for creating and sending REST Web service requests (as an object for importing).

val request = Request(GET, new URI("http://api.rest.org/person", Map(), None))
val response = driver.execute(request)
response.statusCode should be(Status.OK)
response.body match {
  Some(body) => objectMapper.readValue[List[Person]](body) should have length(0)
  None => fail("Expected a body"))
}

or using the Api.RequestBuilder

val request = driver.execute(RequestBuilder().withUrl("http://api.rest.org/person/").withMethod(GET))

This provides the basic interface used to implement the Dsl, users are expected to use the Dsl.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Api
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type HttpClient = (Request) ⇒ Response

    Permalink

    Abstract interface for submitting REST Requests and receiving Responses

  2. sealed abstract class Method extends AnyRef

    Permalink

    HTTP Method

  3. case class Request(method: Method, url: URI, headers: Map[String, List[String]] = Map(), body: Option[String] = None) extends Product with Serializable

    Permalink

    The HTTP Request

  4. case class RequestBuilder(method: Option[Method], url: Option[URI], query: Seq[(String, String)], headers: Seq[(String, String)], queryParams: Seq[(String, String)], body: Option[String]) extends Product with Serializable

    Permalink

    Builder to make creating Request objects nicer - normally this should be driven through the Dsl.

  5. case class Response(statusCode: Int, headers: Map[String, List[String]], body: Option[String]) extends Product with Serializable

    Permalink

    The HTTP Response

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object DELETE extends Method with Product with Serializable

    Permalink

    HTTP delete method

  5. object GET extends Method with Product with Serializable

    Permalink

    HTTP get method

  6. object HEAD extends Method with Product with Serializable

    Permalink

    HTTP head method

  7. object PATCH extends Method with Product with Serializable

    Permalink

    HTTP patch method

  8. object POST extends Method with Product with Serializable

    Permalink

    HTTP post method

  9. object PUT extends Method with Product with Serializable

    Permalink

    HTTP put method

  10. object RequestBuilder extends Serializable

    Permalink

    Helper object for RequestBuilder class, supplies the emptyBuilder instance and access to the current implicit builder.

  11. object Status

    Permalink

    Constants for HTTP Status Codes

  12. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  18. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  21. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  24. def toHeaders(hs: (String, String)*): Map[String, List[String]]

    Permalink

    Convert a sequence of (name, value) tuples into a map of headers.

    Convert a sequence of (name, value) tuples into a map of headers. Each tuple creates an entry in the map, duplicate names add the value to the list.

  25. def toQueryString(qs: (String, String)*): String

    Permalink
  26. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  27. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped