Liking cljdoc? Tell your friends :D

finagle-clojure.http.message

Functions for working with [[com.twitter.finagle.http.Message]] and its concrete subclasses, [[com.twitter.finagle.http.Request]] and [[com.twitter.finagle.http.Response]].

Request objects are passed to services bound to a Finagle HTTP server, and Response objects must be passed back (wrapped in a Future) in turn. Most requests are constructed by Finagle, but the functions here to may be helpful to create MockRequests for service testing purposes.

Functions for working with [[com.twitter.finagle.http.Message]] and its concrete subclasses,
[[com.twitter.finagle.http.Request]] and [[com.twitter.finagle.http.Response]].

`Request` objects are passed to services bound to a Finagle HTTP server, and `Response` objects must be passed back
(wrapped in a `Future`) in turn. Most requests are constructed by Finagle, but the functions here to may be helpful
to create `MockRequest`s for service testing purposes.
raw docstring

charsetclj

(charset msg)

Gets the charset of the given message.

Arguments:

  • msg: a [[com.twitter.finagle.http.Message]]

Returns:

the charset of the message

Gets the charset of the given message.

*Arguments*:

  * `msg`: a [[com.twitter.finagle.http.Message]]

*Returns*:

  the charset of the message
sourceraw docstring

content-stringclj

(content-string msg)

Gets the content string of the given message.

Arguments:

  • msg: a [[com.twitter.finagle.http.Message]]

Returns:

the content string of the message

Gets the content string of the given message.

*Arguments*:

  * `msg`: a [[com.twitter.finagle.http.Message]]

*Returns*:

  the content string of the message
sourceraw docstring

content-typeclj

(content-type msg)

Gets the content type of the given message.

Arguments:

  • msg: a [[com.twitter.finagle.http.Message]]

Returns:

the content type of the message

Gets the content type of the given message.

*Arguments*:

  * `msg`: a [[com.twitter.finagle.http.Message]]

*Returns*:

  the content type of the message
sourceraw docstring

(header msg header)

Gets the named header from the given message.

Arguments:

  • msg: a [[com.twitter.finagle.http.Message]]
  • header: a string containing the header name

Returns:

A seq of strings that are the values for the named header in the given message

Gets the named header from the given message.

*Arguments*:

  * `msg`: a [[com.twitter.finagle.http.Message]]
  * `header`: a string containing the header name

*Returns*:

  A seq of strings that are the values for the named header in the given message
sourceraw docstring

headersclj

(headers msg)

Returns this message's headers as a Clojure map.

Arguments:

  • msg: a [[com.twitter.finagle.http.Message]]

Returns:

this request's headers as a Clojure map

Returns this message's headers as a Clojure map.

*Arguments*:

  * `msg`: a [[com.twitter.finagle.http.Message]]

*Returns*:

  this request's headers as a Clojure map
sourceraw docstring

http-methodclj

(http-method req)

Gets the HTTP method of the given request.

Arguments:

  • req: a [[com.twitter.finagle.http.Request]]

Returns:

the HTTP method of the request as an uppercase string

Gets the HTTP method of the given request.

*Arguments*:

  * `req`: a [[com.twitter.finagle.http.Request]]

*Returns*:

  the HTTP method of the request as an uppercase string
sourceraw docstring

input-streamclj

(input-stream msg)

Returns this message's content as an input stream.

Arguments:

  • msg: a [[com.twitter.finagle.http.Message]]

Returns:

this request's content as an input stream

Returns this message's content as an input stream.

*Arguments*:

  * `msg`: a [[com.twitter.finagle.http.Message]]

*Returns*:

  this request's content as an input stream
sourceraw docstring

paramclj

(param req param)

Returns the named param from the given request.

Arguments:

  • req: a [[com.twitter.finagle.http.Request]]

Returns:

the string contents of the named param

Returns the named param from the given request.

*Arguments*:

  * `req`: a [[com.twitter.finagle.http.Request]]

*Returns*:

  the string contents of the named param
sourceraw docstring

paramsclj

(params req)

Returns this request's params as a Clojure map.

Arguments:

  • req: a [[com.twitter.finagle.http.Request]]

Returns:

this request's params as a Clojure map

Returns this request's params as a Clojure map.

*Arguments*:

  * `req`: a [[com.twitter.finagle.http.Request]]

*Returns*:

  this request's params as a Clojure map
sourceraw docstring

requestclj

(request uri)
(request uri method)

Constructs a Request. Usually this will be constructed on your behalf for incoming requests; this function is useful primarily testing purposes, and indeed returns a MockRequest in its current form.

Arguments:

  • uri: the URI of the request
  • method (optional): a keyword or string of the desired HTTP method

Returns:

an instance of [[com.twitter.finagle.http.Request]], specifically a MockRequest

Constructs a `Request`. Usually this will be constructed on your behalf for incoming requests;
this function is useful primarily testing purposes, and indeed returns a `MockRequest` in its current form.

*Arguments*:

  * `uri`: the URI of the request
  * `method` (optional): a keyword or string of the desired HTTP method

*Returns*:

  an instance of [[com.twitter.finagle.http.Request]], specifically a MockRequest
sourceraw docstring

responseclj

(response)
(response code)

Constructs a Response, required for Finagle services that interact with an HttpServer.

Arguments:

  • code (optional): a number representing the desired HTTP status code of the response

Returns:

an instance of [[com.twitter.finagle.http.Response]]

Constructs a `Response`, required for Finagle services that interact with an `HttpServer`.

*Arguments*:

  * `code` (optional): a number representing the desired HTTP status code of the response

*Returns*:

  an instance of [[com.twitter.finagle.http.Response]]
sourceraw docstring

set-charsetclj

(set-charset msg charset)

Sets the charset of the given message.

Arguments:

  • msg: a [[com.twitter.finagle.http.Message]]
  • charset: a string charset

Returns:

the given message

Sets the charset of the given message.

*Arguments*:

  * `msg`: a [[com.twitter.finagle.http.Message]]
  * `charset`: a string charset

*Returns*:

  the given message
sourceraw docstring

set-content-stringclj

(set-content-string msg content)

Sets the content string of the given message.

Arguments:

  • msg: a [[com.twitter.finagle.http.Message]]
  • content: a string of content

Returns:

the given message

Sets the content string of the given message.

*Arguments*:

  * `msg`: a [[com.twitter.finagle.http.Message]]
  * `content`: a string of content

*Returns*:

  the given message
sourceraw docstring

set-content-typeclj

(set-content-type msg type)
(set-content-type msg type charset)

Sets the content type of the given message.

Arguments:

  • msg: a [[com.twitter.finagle.http.Message]]
  • type: a string containing the message's content-type
  • charset (optional, default: utf-8): the charset of the content

Returns:

the given message

Sets the content type of the given message.

*Arguments*:

  * `msg`: a [[com.twitter.finagle.http.Message]]
  * `type`: a string containing the message's content-type
  * `charset` (optional, default: `utf-8`): the charset of the content

*Returns*:

  the given message
sourceraw docstring

set-headerclj

(set-header msg name value)

Sets the named header in the given message.

Arguments:

  • msg: a [[com.twitter.finagle.http.Message]]
  • name: a string containing the header name
  • value: a stringable object containing the value

Returns:

the given message
Sets the named header in the given message.

*Arguments*:

  * `msg`: a [[com.twitter.finagle.http.Message]]
  * `name`: a string containing the header name
  * `value`: a stringable object containing the value

  *Returns*:

    the given message
sourceraw docstring

set-http-methodclj

(set-http-method req meth)

Sets the HTTP method of the given request.

Arguments:

  • req: a [[com.twitter.finagle.http.Request]]
  • meth: a string or keyword containing a valid HTTP method

Returns:

the given request

Sets the HTTP method of the given request.

*Arguments*:

  * `req`: a [[com.twitter.finagle.http.Request]]
  * `meth`: a string or keyword containing a valid HTTP method

*Returns*:

  the given request
sourceraw docstring

set-status-codeclj

(set-status-code resp code)

Sets the status code of the given response.

Arguments:

  • resp: a [[com.twitter.finagle.http.Response]]
  • code: a number with the desired HTTP status code

Returns:

the given response

Sets the status code of the given response.

*Arguments*:

  * `resp`: a [[com.twitter.finagle.http.Response]]
  * `code`: a number with the desired HTTP status code

*Returns*:

  the given response
sourceraw docstring

status-codeclj

(status-code resp)

Returns the status code of the given Response.

Arguments:

  • resp: a [[com.twitter.finagle.http.Response]]

Returns:

the status code of the response as an int

Returns the status code of the given `Response`.

*Arguments*:

  * `resp`: a [[com.twitter.finagle.http.Response]]

*Returns*:

  the status code of the response as an int
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close