testapi

package
v1.12.0 Latest Latest
Warning

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

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

Documentation

Overview

Package testapi is an in-process fake of the webtor API used by the CLI's testscript suite. One handler serves both error dialects: Mode "webui" answers with the {"error":{code,message}} envelope, requires a Bearer key and offers the account surface incl. the device flow; Mode "restapi" answers with rest-api's bare-string errors and only the resource surface.

Index

Constants

View Source
const (
	SintelID = "08ada5a7a6183aae1e09d831df6748d566095a10"
	ValidKey = "99999999-8888-7777-6666-555555555555"
	// FileBytes is the /dl payload. Newline-terminated lines so testscript
	// txtar files (which always end with a newline) can hold exact prefixes
	// of it for resume tests.
	FileBytes = "line1\nline2\nline3\n"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Mode string // "webui" or "restapi"
	// ConfirmAfter is how many device/token polls answer pending before the
	// key is delivered.
	ConfirmAfter int
	// contains filtered or unexported fields
}

func New

func New(mode string) *Server

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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