FRENDS⁴ Common Components : Frends.Acc.SimpleTasks.HttpResultTask.CreateHttpResult

This task creates a HTTP that can be returned from a process that has a HTTP trigger. The task makes it possible to manually set content-type, encoding, content and HTTP headers for the response.

Input Parameters

Parameter nameDescriptionData typeExample values
Http status code

HTTP response status code.

Integer

200

Content type

 

Response content type. Affects response HTTP header "Content-Type" String"application/xml"
Content encoding

Response encoding. Affects response HTTP header "Content-Type"

String "UTF-8"
ContentResponse body content.String"<foo><bar></bar></foo>"
Http Headers

Collection of HTTP parameters for the response.

Parameter nameDescriptionData typeExample
NameName of the argumentString "Set-Cookie"
ValueValue of the argumentString  "UserId=3;"
Object collection 

Output

Response object that can be returned from a process end node to allow HTTP response with a HTTP trigger.

Example Usage

Http status code: "200"

Content type: "application/json"

Content encoding: "UTF-8"

Content: "{\"foo\": \"bar\"}"

Http Headers:

  • Header 1:
    • Name: "Set-Cookie"
    • Value: "UserId=3;"

Resulting http response

HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Set-Cookie: UserId=3;

{"foo":"bar"}