class FakeRequest[+A] extends Request[A]
A Request
with a few extra methods that are useful for testing.
- A
the body content type.
- Source
- Fakes.scala
- Alphabetic
- By Inheritance
- FakeRequest
- Request
- RequestHeader
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
lazy val
acceptLanguages: Seq[Lang]
The Request Langs extracted from the Accept-Language header and sorted by preference (preferred first).
The Request Langs extracted from the Accept-Language header and sorted by preference (preferred first).
- Definition Classes
- RequestHeader
-
lazy val
acceptedTypes: Seq[MediaRange]
- returns
The media types list of the request’s Accept header, sorted by preference (preferred first).
- Definition Classes
- RequestHeader
-
def
accepts(mimeType: String): Boolean
Check if this request accepts a given media type.
Check if this request accepts a given media type.
- returns
true if
mimeType
matches the Accept header, otherwise false
- Definition Classes
- RequestHeader
-
def
addAttr[B](key: TypedKey[B], value: B): Request[A]
Create a new versions of this object with the given attribute attached to it.
Create a new versions of this object with the given attribute attached to it.
- key
The new attribute key.
- value
The attribute value.
- returns
The new version of this object with the new attribute.
- Definition Classes
- Request → RequestHeader
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asJava: RequestHeader
- Definition Classes
- RequestHeader
-
def
attrs: TypedMap
A map of typed attributes associated with the request.
A map of typed attributes associated with the request.
- Definition Classes
- FakeRequest → RequestHeader
-
def
body: A
The body content.
The body content.
- Definition Classes
- FakeRequest → Request
-
lazy val
charset: Option[String]
Returns the charset of the request for text-based body
Returns the charset of the request for text-based body
- Definition Classes
- RequestHeader
-
final
def
clientCertificateChain: Option[Seq[X509Certificate]]
The X509 certificate chain presented by a client during SSL requests.
The X509 certificate chain presented by a client during SSL requests. This method is equivalent to
connection.clientCertificateChain
.- Definition Classes
- RequestHeader
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
connection: RemoteConnection
The remote connection that made the request.
The remote connection that made the request.
- Definition Classes
- FakeRequest → RequestHeader
-
lazy val
contentType: Option[String]
Returns the value of the Content-Type header (without the parameters (eg charset))
Returns the value of the Content-Type header (without the parameters (eg charset))
- Definition Classes
- RequestHeader
-
def
cookies: Cookies
The HTTP cookies.
The HTTP cookies. The request's cookies are stored in an attribute indexed by play.api.mvc.request.RequestAttrKey.Cookies. The attribute uses a Cell to store the cookies, to allow them to be evaluated on-demand.
- Definition Classes
- RequestHeader
-
lazy val
domain: String
The HTTP domain.
The HTTP domain. The domain part of the request's host.
- Definition Classes
- RequestHeader
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flash: Flash
Parses the
Flash
cookie and returns theFlash
data.Parses the
Flash
cookie and returns theFlash
data. The request's flash cookie is stored in an attribute indexed by play.api.mvc.request.RequestAttrKey.Flash. The attribute uses a play.api.mvc.request.Cell to store the session, to allow it to be evaluated on-demand.- Definition Classes
- RequestHeader
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getMethod: String
Returns the current method
-
def
getQueryString(key: String): Option[String]
Helper method to access a queryString parameter.
Helper method to access a queryString parameter. This method delegates to
connection.getQueryParameter(key)
.- returns
The query parameter's value if the parameter is present and there is only one value. If the parameter is absent or there is more than one value for that parameter then
None
is returned.
- Definition Classes
- RequestHeader
-
def
hasBody: Boolean
True if this request has a body.
True if this request has a body. This is either done by inspecting the body itself to see if it is an entity representing an "empty" body.
- Definition Classes
- Request → RequestHeader
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
headers: Headers
The HTTP headers.
The HTTP headers.
- Definition Classes
- FakeRequest → RequestHeader
-
lazy val
host: String
The HTTP host (domain, optionally port).
The HTTP host (domain, optionally port). This value is derived from the request target, if a hostname is present. If the target doesn't have a host then the
Host
header is used, if present. If that's not present then an empty string is returned.- Definition Classes
- RequestHeader
-
final
def
id: Long
The request id.
The request id. The request id is stored as an attribute indexed by play.api.mvc.request.RequestAttrKey.Id.
- Definition Classes
- RequestHeader
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
map[B](f: (A) ⇒ B): Request[B]
Transform the request body.
Transform the request body.
- Definition Classes
- Request
-
lazy val
mediaType: Option[MediaType]
The media type of this request.
The media type of this request. Same as contentType, except returns a fully parsed media type with parameters.
- Definition Classes
- RequestHeader
-
def
method: String
The HTTP method.
The HTTP method.
- Definition Classes
- FakeRequest → RequestHeader
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
path: String
The URI path.
The URI path. This method delegates to
target.path
.- Definition Classes
- RequestHeader
-
final
def
queryString: Map[String, Seq[String]]
The parsed query string.
The parsed query string. This method delegates to
target.queryMap
.- Definition Classes
- RequestHeader
-
def
rawQueryString: String
Returns the raw query string.
Returns the raw query string. This method delegates to
connection.rawQueryString
.- Definition Classes
- RequestHeader
-
final
def
remoteAddress: String
The client IP address.
The client IP address.
retrieves the last untrusted proxy from the Forwarded-Headers or the X-Forwarded-*-Headers.
This method delegates to
connection.remoteAddressString
.- Definition Classes
- RequestHeader
-
final
def
secure: Boolean
Is the client using SSL? This method delegates to
connection.secure
.Is the client using SSL? This method delegates to
connection.secure
.- Definition Classes
- RequestHeader
-
def
session: Session
Parses the
Session
cookie and returns theSession
data.Parses the
Session
cookie and returns theSession
data. The request's session cookie is stored in an attribute indexed by play.api.mvc.request.RequestAttrKey.Session. The attribute uses a Cell to store the session cookie, to allow it to be evaluated on-demand.- Definition Classes
- RequestHeader
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
target: RequestTarget
The target of the HTTP request, i.e.
The target of the HTTP request, i.e. the URI or path that was given on the first line of the request.
- Definition Classes
- FakeRequest → RequestHeader
-
def
toString(): String
- Definition Classes
- RequestHeader → AnyRef → Any
-
final
def
uri: String
The complete request URI, containing both path and query string.
The complete request URI, containing both path and query string. The URI is what was on the status line after the request method. E.g. in "GET /foo/bar?q=s HTTP/1.1" the URI should be /foo/bar?q=s. It could be absolute, some clients send absolute URLs, especially proxies, e.g. http://www.example.org/foo/bar?q=s.
This method delegates to
target.uriString
.- Definition Classes
- RequestHeader
-
def
version: String
The HTTP version.
The HTTP version.
- Definition Classes
- FakeRequest → RequestHeader
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
withAttrs(attrs: TypedMap): FakeRequest[A]
Create a new version of this object with the given attributes attached to it.
Create a new version of this object with the given attributes attached to it. This replaces any existing attributes.
- returns
The new version of this object with the attributes attached.
- Definition Classes
- FakeRequest → Request → RequestHeader
-
def
withBody[B](body: B): FakeRequest[B]
Attach a body to this header.
Attach a body to this header.
- body
The body to attach.
- returns
A new request with the body attached to the header.
- Definition Classes
- FakeRequest → RequestHeader
-
def
withConnection(newConnection: RemoteConnection): FakeRequest[A]
- Definition Classes
- FakeRequest → Request → RequestHeader
-
def
withCookies(cookies: Cookie*): FakeRequest[A]
Constructs a new request with additional Cookies.
-
def
withFlash(data: (String, String)*): FakeRequest[A]
Constructs a new request with additional Flash.
-
def
withFormUrlEncodedBody(data: (String, String)*): FakeRequest[AnyContentAsFormUrlEncoded]
Set a Form url encoded body to this request.
-
def
withHeaders(newHeaders: (String, String)*): FakeRequest[A]
Constructs a new request with additional headers.
Constructs a new request with additional headers. Any existing headers of the same name will be replaced.
-
def
withHeaders(newHeaders: Headers): FakeRequest[A]
The remote connection that made the request.
The remote connection that made the request.
- Definition Classes
- FakeRequest → Request → RequestHeader
-
def
withJsonBody(json: JsValue): FakeRequest[AnyContentAsJson]
Adds a JSON body to the request.
-
def
withMethod(newMethod: String): FakeRequest[A]
Return a new copy of the request with its method changed.
Return a new copy of the request with its method changed.
- Definition Classes
- FakeRequest → Request → RequestHeader
-
def
withMultipartFormDataBody(form: MultipartFormData[TemporaryFile]): FakeRequest[AnyContentAsMultipartFormData]
Adds a multipart form data body to the request
-
def
withRawBody(bytes: ByteString): FakeRequest[AnyContentAsRaw]
Adds a raw body to the request
-
def
withSession(newSessions: (String, String)*): FakeRequest[A]
Constructs a new request with additional session.
-
def
withTag(tagName: String, tagValue: String): RequestHeader
Convenience method for adding a single tag to this request
Convenience method for adding a single tag to this request
- returns
the tagged request
- Definition Classes
- RequestHeader
-
def
withTarget(newTarget: RequestTarget): FakeRequest[A]
Return a new copy of the request with its target changed.
Return a new copy of the request with its target changed.
- Definition Classes
- FakeRequest → Request → RequestHeader
-
def
withTextBody(text: String): FakeRequest[AnyContentAsText]
Adds a text body to the request.
-
def
withVersion(newVersion: String): FakeRequest[A]
Return a new copy of the request with its HTTP version changed.
Return a new copy of the request with its HTTP version changed.
- Definition Classes
- FakeRequest → Request → RequestHeader
-
def
withXmlBody(xml: NodeSeq): FakeRequest[AnyContentAsXml]
Adds an XML body to the request.
Deprecated Value Members
-
def
copy(id: Long = null, tags: Map[String, String] = null, uri: String = null, path: String = null, method: String = this.method, version: String = this.version, queryString: Map[String, Seq[String]] = null, headers: Headers = null, remoteAddress: String = null, secure: Boolean = null, clientCertificateChain: Option[Seq[X509Certificate]] = null): RequestHeader
Copy the request.
Copy the request.
- Definition Classes
- RequestHeader
- Annotations
- @deprecated
- Deprecated
(Since version 2.6.0) Use the with* methods instead
-
def
copyFakeRequest[B](id: Long = null, tags: Map[String, String] = null, uri: String = null, path: String = null, method: String = null, version: String = null, headers: Headers = null, remoteAddress: String = null, secure: Boolean = null, clientCertificateChain: Option[Seq[X509Certificate]] = null, body: B = body): FakeRequest[B]
- Annotations
- @deprecated
- Deprecated
(Since version 2.6.0) Use with* methods instead.
-
final
def
tags: Map[String, String]
The request Tags.
The request Tags. The request's tags are stored in an optional attribute indexed by play.api.mvc.request.RequestAttrKey.Tags. If the attribute is not present then the tags are assumed to be empty.
- Definition Classes
- RequestHeader
- Annotations
- @deprecated
- Deprecated
(Since version 2.6.0) Use typed attributes instead, see
attrs