web

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package web builds and sends authenticated HTTP requests to a GitHub web host; it knows nothing about upload API shapes — see internal/github/attachments for that.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client makes GitHub web HTTP calls, scoping cookies to each request's destination host.

func NewClient

func NewClient(httpClient *http.Client, userAgent string, cookies []*http.Cookie) *Client

func (*Client) Do added in v0.4.2

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) DoMultipart

func (c *Client) DoMultipart(ctx context.Context, req Request) ([]byte, error)

DoMultipart streams the multipart body, applies headers/cookie/user-agent, and returns the response body.

func (*Client) Get

func (c *Client) Get(ctx context.Context, pageURL string) (body []byte, statusCode int, err error)

Get issues a plain GET; non-2xx is reported via statusCode, not err — only a transport failure is an error.

type Request

type Request struct {
	Method   string
	URL      string
	Fields   map[string]string
	Headers  map[string]string
	FilePath string // non-empty attaches the file as the "file" form part
	Referer  string // non-empty applies setDefaultHeaders(req, referer)
}

Request is a pure description of one multipart HTTP call's shape; DoMultipart turns it into an actual request.

type Session added in v0.4.1

type Session struct {
	Cookies   []*http.Cookie
	UserAgent string
}

Session is the browser-compatible authentication context shared by GitHub web requests.

Jump to

Keyboard shortcuts

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