Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HeaderPairs ¶
HeaderPairs splits raw header lines into name/value pairs, preserving the raw (unresolved) values and the order they appear in.
func SplitEssentials ¶
SplitEssentials splits a raw request line into method, URL, and protocol without parsing the URL, so {{placeholders}} stay intact. The method defaults to GET like parseEssentials.
Types ¶
type Directives ¶
type Directives struct {
NoRedirect bool
NoCookieJar bool
NoLog bool
Timeout time.Duration
Vegeta *VegetaDirective
}
Directives are per-request execution options set via `# @...` comments.
type File ¶
File is the parsed form of one .http file: in-file variables plus one request template per `###`-separated block.
type FormField ¶
type Script ¶
Script is a pre-request or response handler script: inline `{% ... %}` code, or a path to a .js file relative to the .http file.
type Template ¶
type Template struct {
Name string
Directives Directives
Essentials string
HeadersRaw string
BodyRaw string
PreScript Script
PostScript Script
}
Template is a single request block with its raw sections still containing {{placeholders}}. Resolution happens at Build time, just before sending, so later requests can use variables produced by earlier responses. Scripts are never resolved — {{ }} inside script source stays untouched.
func (*Template) Build ¶
Build resolves placeholders in the template's sections and constructs the *http.Request. wd is the directory file includes resolve against.
func (*Template) BuildGRPC ¶
func (t *Template) BuildGRPC(resolve func(string) string) (rawURL string, headers [][2]string, body string)
BuildGRPC resolves the template's sections for a gRPC send: the raw target URL, the header pairs (future metadata), and the JSON body. Like Build, resolution happens here at send time so request chaining works.