Documentation
¶
Overview ¶
Package project discovers .http files under a directory and indexes their requests by name.
Index ¶
- Constants
- type AuthConfig
- type Config
- type Project
- func (p *Project) CapturedBy(name string) *httpfile.Request
- func (p *Project) File(path string) *httpfile.File
- func (p *Project) Lookup(name string) (*httpfile.Request, error)
- func (p *Project) Requests() []*httpfile.Request
- func (p *Project) Resolve(target string) ([]*httpfile.Request, error)
- func (p *Project) Validate() []httpfile.Diagnostic
- type TestConfig
Constants ¶
const ConfigFile = "apic.yaml"
ConfigFile is the optional per-project configuration file name.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
Default string `yaml:"default"` // auth spec applied to requests without `# @auth`, e.g. "aws region=eu-west-2"
AllowExec bool `yaml:"allowExec"` // permit `# @auth exec ...`
}
AuthConfig is the `auth:` section of apic.yaml.
type Config ¶
type Config struct {
Env string `yaml:"env"` // default environment
Dir string `yaml:"dir"` // directory holding .http files, relative to the project root
Timeout string `yaml:"timeout"` // default request timeout, e.g. "30s"
Auth AuthConfig `yaml:"auth"`
Test TestConfig `yaml:"test"`
}
Config is the content of apic.yaml.
type Project ¶
type Project struct {
Root string // absolute path of the project root (where apic.yaml / env files live)
Config Config
Files []*httpfile.File
Diagnostics []httpfile.Diagnostic
// contains filtered or unexported fields
}
Project is a loaded set of .http files.
func (*Project) CapturedBy ¶
CapturedBy returns the first request that captures a variable of this name.
func (*Project) File ¶
File returns the request file at path (relative to the root, or absolute), or nil. The whole path is the file name: a `#` in it is not a fragment.
func (*Project) Resolve ¶
Resolve turns a command-line target into one or more requests:
get-user a request by @name users.http every request in that file, in order users.http#get-user a named request in a specific file users.http#3 the third request in that file
func (*Project) Validate ¶
func (p *Project) Validate() []httpfile.Diagnostic
Validate returns parse diagnostics plus project-level checks.
type TestConfig ¶
type TestConfig struct {
Paths []string `yaml:"paths"` // feature files or directories, relative to the root (default: features)
}
TestConfig is the `test:` section of apic.yaml.