profile

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTestProfile

func CreateTestProfile(profileName string, profileContent string, profilesDir string)

CreateTestProfile helper method for testing. Will create a profile file with the specified content in the specified directory.

func GetAvailableProfiles

func GetAvailableProfiles() ([]string, error)

GetAvailableProfiles return the name of all profiles available in the configured directory

func GetAvailableRequests

func GetAvailableRequests(profileName string) ([]string, error)

GetAvailableRequests returns a list of all the names of requests available in a profile.

func GetProfilesDir

func GetProfilesDir() (string, error)

GetProfilesDir return the directory where profiles are stored

func SetupTestProfilesDir

func SetupTestProfilesDir() string

SetupTestProfilesDir helper method for testing. This will create a temporary directory where profiles can be dropped in. It will also set the environment variable so that profile files are read from the temporary directory.

Types

type NamedRequest

type NamedRequest struct {
	Body              string
	FileToUpload      string
	Headers           map[string][]string
	Method            string
	Name              string
	PostProcessScript string
	Source            string // File where this request was loaded from
	URL               string
	Values            map[string][]string
}

NamedRequest is a representation of a request that can be loaded from a profile.

func FindNamedRequest

func FindNamedRequest(mergedProfile *Options, requestName string) (NamedRequest, error)

FindNamedRequest finds a named request in a group of already merged profiles

func (NamedRequest) GetBody

func (req NamedRequest) GetBody() (string, error)

GetBody returns the body for this NamedRequest

func (NamedRequest) GetHeaders

func (req NamedRequest) GetHeaders() map[string][]string

GetHeaders returns the headers for this NamedRequest

func (NamedRequest) GetMethod

func (req NamedRequest) GetMethod() string

GetMethod return the HTTP method for this NamedRequest

func (NamedRequest) GetValues

func (req NamedRequest) GetValues() map[string][]string

GetValues returns the values for this NamedRequest

type Options

type Options struct {
	BaseURL      string
	Headers      map[string][]string
	NamedRequest map[string]NamedRequest
	Variables    map[string]string
}

Options that can come from a profile file.

func LoadAndMergeProfiles

func LoadAndMergeProfiles(profileNames []string) (Options, error)

LoadAndMergeProfiles loads all profiles and merge them in the order passed in

func LoadProfile

func LoadProfile(profileName string) (loadedOptions Options, err error)

LoadProfile loads Options for a specific profile by name.

func MergeOptions

func MergeOptions(profiles []Options) Options

MergeOptions merges all options passed in into a final Options object.

func (Options) GetHeaders

func (ops Options) GetHeaders() map[string][]string

GetHeaders returns the headers set in this option

Jump to

Keyboard shortcuts

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