Skip to content
Snippets Groups Projects
Unverified Commit dfe26fcf authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

use CURL instead of `http get` lol

parent 2d1590a6
Branches
Tags
1 merge request!3use CURL instead of `http get` lol
......@@ -7,6 +7,20 @@ const HTTP = {
const DEFAULT_IP = "127.0.0.1:3000"
def "http get-curl" [url: string, --allow-errors, --full]: nothing -> record<body: string, status: int> {
$url
| str replace --all ' ' "%20"
| curl -i $in
| lines
| split list ""
| update 0 { get 0 | parse "HTTP/{v} {c} {m}" | into record }
| update 1 { get 0 }
| {
body: ($in.1 | str replace --regex '^"' '' | str replace --regex '"$' '' | from json),
status: ($in.0.c | into int),
}
}
def run-command [node: string]: string -> any {
let command = $in
......@@ -17,7 +31,7 @@ def run-command [node: string]: string -> any {
| insert scheme "http"
| insert path $command
| url join
| http get $in --allow-errors --full
| http get-curl $in --allow-errors --full
if $res.status == $HTTP.NOT_FOUND {
error make --unspanned {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment