state

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package state persists variables scripts set via "client.global" across separate "httpfly run" invocations, so e.g. an auth token fetched by one run is still there the next time you run a different request that needs it.

Index

Constants

View Source
const Dir = ".httpfly"

Dir is the directory httpfly stores its state in, alongside the .http file being run.

View Source
const FileName = "state.json"

FileName is the state file within Dir.

Variables

This section is empty.

Functions

func Load

func Load(dir, envName string) (map[string]string, error)

Load returns the persisted global variables for the given directory and environment name (pass "" if -env wasn't used; environments are kept in separate buckets so a value set while running against "prod" never leaks into a "dev" run). A missing state file, or a file with no bucket for this environment yet, is normal -- nothing has been persisted yet -- and returns an empty map, not an error.

func Save

func Save(dir, envName string, vars map[string]string) error

Save writes vars as the persisted global variables for the given directory and environment name, read-modify-writing the state file so other environments' buckets are left untouched. It creates Dir if it doesn't exist yet.

Types

This section is empty.

Jump to

Keyboard shortcuts

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