commit
170bdcc33a
|
@ -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_
|
||||
|
||||
|
@ -25,7 +25,8 @@ import "experimental/http"
|
|||
|
||||
http.get(
|
||||
url: "http://localhost:9999/",
|
||||
headers: {x:"a", y:"b", z:"c"}
|
||||
headers: {x:"a", y:"b", z:"c"},
|
||||
timeout: 30s
|
||||
)
|
||||
```
|
||||
|
||||
|
@ -41,6 +42,34 @@ Headers to include with the GET request.
|
|||
|
||||
_**Data type:** Object_
|
||||
|
||||
### timeout
|
||||
Timeout for the GET request.
|
||||
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
|
||||
|
@ -55,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
|
||||
```
|
||||
|
|
|
@ -16,6 +16,24 @@ Though newer versions of Flux may be available, they will not be included with
|
|||
InfluxDB until the next InfluxDB v2.0 release._
|
||||
{{% /note %}}
|
||||
|
||||
## v0.56.0 [2019-12-05]
|
||||
|
||||
### Features
|
||||
- Crate for typing Flux standard library.
|
||||
- Serialize type environment.
|
||||
- Improve filter performance when filtering on values.
|
||||
- Update usage duration test to exclude queue and requeue time.
|
||||
- Add types for some built-ins.
|
||||
- Add `timeout` parameter to experimental `http.get()`.
|
||||
|
||||
### Bug fixes
|
||||
- Properly use a fake version with `flux-config` when no version is present.
|
||||
- Address clippy lints.
|
||||
- Add bytes monotype to Rust semantic module.
|
||||
- Allow underscores (`_`) in type expressions.
|
||||
|
||||
---
|
||||
|
||||
## v0.55.1 [2019-12-02]
|
||||
|
||||
### Bug fixes
|
||||
|
|
Loading…
Reference in New Issue