From 63da1b0703194ab9684ce5e17662c1675a417b1e Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 9 Dec 2019 17:07:31 -0700 Subject: [PATCH] added details about http.get reponse format --- .../flux/stdlib/experimental/http/get.md | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/content/v2.0/reference/flux/stdlib/experimental/http/get.md b/content/v2.0/reference/flux/stdlib/experimental/http/get.md index 0ee6601e9..64094967c 100644 --- a/content/v2.0/reference/flux/stdlib/experimental/http/get.md +++ b/content/v2.0/reference/flux/stdlib/experimental/http/get.md @@ -2,7 +2,7 @@ title: http.get() function description: > The `http.get()` function submits an HTTP GET request to the specified URL and - returns the HTTP status code as an integer and the response body as a byte array. + returns the HTTP status code, response body, and response headers. menu: v2_0_ref: name: http.get @@ -11,7 +11,7 @@ weight: 301 --- The `http.get()` function submits an HTTP GET request to the specified URL and -returns the HTTP status code as an integer and the response body as a byte array. +returns the HTTP status code, response body, and response headers. _**Function type:** Miscellaneous_ @@ -48,6 +48,28 @@ Default is `30s`. _**Data type:** Duration_ +## Response format +`http.get` returns an object that contains the following: + +- [statusCode](#statuscode) +- [body](#body) +- [headers](#headers) + +### statusCode +The HTTP status code returned by the GET request. + +_**Data type:** Integer_ + +### body +The response body. + +_**Data type:** Byte Array_ + +### headers +Headers included with the response. + +_**Data type:** Object_ + ## Examples ##### Get the status of InfluxDB @@ -62,6 +84,7 @@ response = http.get( headers: {Authorization: "Token ${token}"} ) -status = response.statusCode -body = string(v: response.body) +httpStatus = response.statusCode +responseBody = string(v: response.body) +responseHeaders = response.headers ```