diff --git a/docs/reference/http.md b/docs/reference/http.md index 7d2440ab..71d6e0b9 100644 --- a/docs/reference/http.md +++ b/docs/reference/http.md @@ -16,10 +16,10 @@ _No input._ ### http.#Delete Outputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*response.body* | `string` |- | -|*response.statusCode* | `_\|_` |- | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*statusCode* | `string` |- | +|*body* | `string` |- | ## http.#Do @@ -29,10 +29,10 @@ _No input._ ### http.#Do Outputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*response.body* | `string` |- | -|*response.statusCode* | `_\|_` |- | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*statusCode* | `string` |- | +|*body* | `string` |- | ## http.#Get @@ -42,10 +42,10 @@ _No input._ ### http.#Get Outputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*response.body* | `string` |- | -|*response.statusCode* | `_\|_` |- | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*statusCode* | `string` |- | +|*body* | `string` |- | ## http.#Post @@ -55,10 +55,10 @@ _No input._ ### http.#Post Outputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*response.body* | `string` |- | -|*response.statusCode* | `_\|_` |- | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*statusCode* | `string` |- | +|*body* | `string` |- | ## http.#Put @@ -68,7 +68,7 @@ _No input._ ### http.#Put Outputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*response.body* | `string` |- | -|*response.statusCode* | `_\|_` |- | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*statusCode* | `string` |- | +|*body* | `string` |- | diff --git a/stdlib/http/http.cue b/stdlib/http/http.cue index 44e495db..d5b99145 100644 --- a/stdlib/http/http.cue +++ b/stdlib/http/http.cue @@ -32,7 +32,6 @@ import ( shell: path: "/bin/bash" always: true - env: { METHOD: method HEADERS: json.Marshal(request.header) @@ -77,11 +76,11 @@ import ( from: ctr path: "/response" } - }.contents @dagger(output) + }.contents @dagger(output) - // Force os.#File exec before Atoi + // Force os.#File exec before Atoi response: { - "body": body + "body": body "statusCode": strconv.Atoi(statusCode) } } diff --git a/stdlib/http/tests/http.cue b/stdlib/http/tests/http.cue index 1a25a6c4..ed7b6945 100644 --- a/stdlib/http/tests/http.cue +++ b/stdlib/http/tests/http.cue @@ -8,29 +8,25 @@ import ( TestRequest: { req: #Get & { url: "https://api.github.com/" - request: header: { - Accept: "application/json" - } + request: header: Accept: "application/json" } testRaw: os.#Container & { image: alpine.#Image & { - package: jq: "~=1.6" - package: bash: true + package: jq: "~=1.6" + package: bash: true } env: STATUS: "\(req.response.statusCode)" files: "/content.json": { content: req.response.body mode: 0o500 } - shell: { - args: ["--noprofile", "--norc", "-eo", "pipefail", "-c"] - } + shell: args: ["--noprofile", "--norc", "-eo", "pipefail", "-c"] command: #Command } } #Command: #""" - test "$(cat /content.json | jq -r .current_user_url)" = 'https://api.github.com/user' - test "$STATUS" = "200" - """# + test "$(cat /content.json | jq -r .current_user_url)" = 'https://api.github.com/user' + test "$STATUS" = "200" + """# diff --git a/stdlib/universe.bats b/stdlib/universe.bats index 330527e3..dde83a32 100644 --- a/stdlib/universe.bats +++ b/stdlib/universe.bats @@ -24,7 +24,7 @@ setup() { } @test "http" { - dagger -e http up + dagger -e http up } @test "js/yarn" {