You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
624 B
HTML

{{- $method := .Get "method" | default "get" -}}
{{- $url := .Get 0 | default (.Get "url") -}}
{{- if not $url -}}
{{- errorf "layouts/shortcodes/paige/request.html: no url" -}}
{{- end -}}
{{- with try (resources.GetRemote $url (dict "method" $method)) -}}
{{- with .Err -}}
{{- errorf "layouts/shortcodes/paige/request.html: cannot request remote resource %q: %v" $url . -}}
{{- else with .Value -}}
{{- strings.TrimRight "\f\n\r\t\v " .Content -}}
{{- else -}}
{{- errorf "layouts/shortcodes/paige/request.html: remote resource %q not found" $url -}}
{{- end -}}
{{- end -}}