fetch

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fetch retrieves an arbitrary URL that is NOT the Payload server.

§13 lets `pay upload` and `pay create` take a remote URL as the file source. That request must not go through internal/payload's transport: it would attach the profile's Authorization header and send the user's Payload credential to a third-party host.

It therefore constructs its own *http.Request, which §3.1 otherwise confines to internal/payload/transport.go. scripts/arch-lint.sh exempts this package for the same reason it exempts internal/update: neither talks to Payload. The exemption is narrow on purpose — this package is a few dozen lines and cannot accumulate a Payload call by accident, which is exactly the risk of exempting a 1,600-line command file instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Body        io.ReadCloser
	ContentType string
	Length      int64
	StatusCode  int
}

Result is an open body plus what the response said about it.

func Get

func Get(ctx context.Context, rt http.RoundTripper, rawurl string, timeout time.Duration) (*Result, error)

Get issues a GET for rawurl and returns the open body on 2xx.

ctx is honoured: it bounds the whole exchange, so --deadline and Ctrl-C interrupt a slow or hanging remote host. (The previous implementation called http.Client.Get and discarded ctx, which made a stalled download ignore both.) The caller closes Body.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL