fakebrowser

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 1 Imported by: 1 module, 1 package

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

Index

Constants

This section is empty.

Variables

View Source
var DefaultHeaders = map[string]string{
	"Accept":          "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8",
	"Accept-Language": "en-US,en;q=0.5",
	"Referer":         "https://duckduckgo.com/",
	"User-Agent":      "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:130.0) Gecko/20100101 Firefox/130.0",
}

DefaultHeaders defines the headers that will be injected into every outgoing request in order to simulate the appearance of a real web browser.

Not very sportsmanlike, but basically effective at letting us fetch page titles.

Functions

This section is empty.

Types

type Option

type Option func(*Transport)

Option customizes a Transport.

func WithHeaders

func WithHeaders(injectHeaders map[string]string) Option

WithHeaders overrides the default set of headers injected into each request.

type Transport

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

Transport is an http.RoundTripper implementation that injects a set of headers into every outgoing request in order to fake the appearance of a real web browser making the request.

func New

func New(transport http.RoundTripper, opts ...Option) *Transport

New creates a new fake browswer transport.

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip executes a single HTTP transaction, after injecting a set of headers into the outgoing request.

Jump to

Keyboard shortcuts

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