snippet

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package snippet renders a resolved request as code that sends the same thing without apic: a curl command, an HTTPie command, PowerShell's Invoke-RestMethod, Python requests, JavaScript fetch or Go net/http.

Every language follows curl's rules. Without redact the snippet runs as printed, credentials included. With redact the header values, body and query values are masked and credentials come from the environment: TOKEN for a bearer or OAuth2 token, APIC_USER and APIC_PASSWORD for basic and digest, APIC_API_KEY for an API key. What a language cannot do on its own (AWS SigV4 signing, digest in fetch) is said in a comment.

Index

Constants

This section is empty.

Variables

View Source
var Languages = []string{"curl", "httpie", "powershell", "python", "js", "go"}

Languages are the snippet languages, in the order the UI cycles them.

Functions

func Curl

func Curl(r *runner.Resolved, redact bool) string

Curl returns a POSIX-shell curl command for the request. With redact set the header values, body and query values are masked and the bearer and basic credentials become shell placeholders, so the command can go into a stored log; without it the command is runnable as printed.

func Render

func Render(lang string, r *runner.Resolved, redact bool) (string, error)

Render returns the snippet for lang.

Types

This section is empty.

Jump to

Keyboard shortcuts

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