The HttpResponse type variable (after any redirection) is a type which contains all information of the response of a query web service routing.
The special keyword CurrentHttpResponse (after any redirection) provide a useful access to the response of a query web service routing.
This variable is within the local scope, so is available only in the Response success or error of a query web service routing.
This topic covers:
Returns a dictionary with all the headers of the response.
Return a Dictionary of string or array of string.
' GET https://postman-echo.com/response-headers?Content-Type=text/html&test=response_headers
' Headers
' @{
' "access-control-allow-credentials" : "",
' "access-control-allow-headers" : "",
' "access-control-allow-methods" : "",
' "access-control-allow-origin" : "",
' "access-control-expose-headers" : "",
' "connection" : "keep-alive",
' "content-encoding" : "gzip"
' "content-length" : "71",
' "content-type" : "text/html; charset=utf-8",
' "date" : "Mon, 28 Aug 2017 10:22:07 GMT",
' "etag" : "W/"36-qe7rHYvOo7E1gYg5rYfFsg"",
' "server" : "nginx/1.10.2",
' "test" : "response_headers",
' "vary" : "Accept-Encoding"
' }
CurrentHttpResponse.Headers.Count ' => "14"
CurrentHttpResponse.Headers.TypeOf() ' => "dictionary"
CurrentHttpResponse.Headers["connection"].TypeOf() ' => "variant"
CurrentHttpResponse.Headers["connection"].InnerTypeOf() ' => "string"
CurrentHttpResponse.Headers["connection"] ' => "keep-alive"
CurrentHttpResponse.Headers["content-length"].TypeOf() ' => "variant"
CurrentHttpResponse.Headers["content-length"].InnerTypeOf() ' => "string"
CurrentHttpResponse.Headers["content-length"] ' => "71"
CurrentHttpResponse.Headers["access-control-allow-headers"].TypeOf() ' => "variant"
CurrentHttpResponse.Headers["access-control-allow-headers"].InnerTypeOf() ' => "string"
CurrentHttpResponse.Headers["access-control-allow-headers"] ' => ""
Returns the status code of the response as number.
Return a Number
' GET https://postman-echo.com/response-headers?Content-Type=text/html&test=response_headers CurrentHttpResponse.StatusCode ' => 200
Returns the status code message of the response as string.
Return a String
' GET https://postman-echo.com/response-headers?Content-Type=text/html&test=response_headers CurrentHttpResponse.StatusCodeMessage ' => "OK"
Returns the body of the response as string.
Return a String
' GET https://postman-echo.com/response-headers?Content-Type=text/html&test=response_headers
CurrentHttpResponse.Body ' => "{"Content-Type":"text/html","test":"response_headers"}"
Returns a string which represent the HttpResponse (express in JSON format).
Returns a String.
' GET https://postman-echo.com/response-headers?Content-Type=text/html&test=response_headers
' Output in a single line (it's broken in different lines here for readability)
CurrentHttpResponse.ToString()
' => {
' "headers" : {
' "access-control-allow-credentials" : "",
' "access-control-allow-headers" : "",
' "access-control-allow-methods" : "",
' "access-control-allow-origin" : "",
' "access-control-expose-headers" : "",
' "connection" : "keep-alive",
' "content-encoding" : "gzip"
' "content-length" : "71",
' "content-type" : "text/html; charset=utf-8",
' "date" : "Mon, 28 Aug 2017 10:22:07 GMT",
' "etag" : "W/"36-qe7rHYvOo7E1gYg5rYfFsg"",
' "server" : "nginx/1.10.2",
' "test" : "response_headers",
' "vary" : "Accept-Encoding"
' },
' "StatusCode" : "200",
' "StatusCodeMessage" : "OK",
' "Body" : "{"Content-Type":"text/html","test":"response_headers"}"
' }
Always return "httpresponse".
Returns a String.
' GET https://postman-echo.com/response-headers?Content-Type=text/html&test=response_headers CurrentHttpResponse.TypeOf() ' => "httpresponse"