naprequest

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Copyright © 2021 Bold City Software

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

request.go - this data structure represents a runnable HTTP request

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

requestresult.go - this data structure represents the results of an executed Nap request

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GraphQLOptions added in v0.4.1

type GraphQLOptions struct {
	Query     string      `json:"query"`
	Variables interface{} `json:"variables"`
}

type Request

type Request struct {
	Name                  string
	Path                  string
	Verb                  string
	TimeoutSeconds        int `yaml:"timeoutSeconds"`
	Headers               map[string]string
	Cookies               map[string]string
	Body                  interface{}
	GraphQL               *GraphQLOptions `yaml:"graphql"`
	PreRequestScript      string          `yaml:"preRequestScript"`
	PostRequestScript     string          `yaml:"postRequestScript"`
	PreRequestScriptFile  string          `yaml:"preRequestScriptFile"`
	PostRequestScriptFile string          `yaml:"postRequestScriptFile"`
	Captures              map[string]string
	Asserts               []string
	Verbose               bool

	// aliases
	Url    string
	Method string
}

func LoadFromPath

func LoadFromPath(path string, ctx *napcontext.Context) (*Request, error)

func (*Request) GetAsserts added in v0.2.0

func (request *Request) GetAsserts(ctx *napcontext.Context) ([]*napassert.Assert, error)

type RequestResult

type RequestResult struct {
	Request           *Request
	HttpResponse      *http.Response
	PreRequestResult  string
	PostRequestResult string
	StartTime         time.Time
	EndTime           time.Time
	Error             error
}

func ResultError

func ResultError(r *Request, err error) *RequestResult

func (*RequestResult) GetElapsedMs

func (r *RequestResult) GetElapsedMs() int64

Jump to

Keyboard shortcuts

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