shared

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeContext

func InitializeContext(ctx context.Context) context.Context

InitializeContext adds the shared session to the context. The new context is returned because context is immutable.

Types

type ContextKey

type ContextKey string

ContextKey defines a type to store the shared session in context.Context.

type Session

type Session struct {
	StatusCode int
}

Session contains the information of shared session

func GetSession

func GetSession(ctx context.Context) *Session

GetSession returns the shared session stored in context. Note that the context should be previously initialized with InitializeContext function.

func (*Session) SaveStatusCode

func (s *Session) SaveStatusCode(ctx context.Context, code int) error

SaveStatusCode save the status code.

func (*Session) ValidateSharedStatusCode

func (s *Session) ValidateSharedStatusCode(ctx context.Context, expectedCode int) error

ValidateStatusCode validates the status code from the base response.

type Steps

type Steps struct {
}

Steps type is responsible to initialize the HTTP client steps in godog framework.

func (Steps) InitializeSteps

func (s Steps) InitializeSteps(ctx context.Context, scenCtx *godog.ScenarioContext) context.Context

InitializeSteps adds base steps to the scenario context. It implements StepsInitializer interface. It returns a new context (context is immutable) with the HTTP Context.

Jump to

Keyboard shortcuts

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