utilgo.mau.fi/util/exfmt Index | Files

package exfmt

import "go.mau.fi/util/exfmt"

Index

Variables

var Day = 24 * time.Hour
var Week = 7 * Day

Functions

func Duration

func Duration(d time.Duration) string

func FormatCurl

func FormatCurl(cli *http.Client, req *http.Request) string

FormatCurl formats the given HTTP request as a curl command.

This will include all headers, and also the request body if GetBody is set. Notes:

* Header names are quoted using fmt.Sprintf, so it may not always be correct for shell quoting. * The URL is only quoted and not escaped, so URLs with single quotes will not currently work.

The client parameter is optional and is used to find cookies from the cookie jar.

Source Files

curl.go duration.go

Version
v0.4.1
Published
Mar 16, 2024
Platform
js/wasm
Imports
7 packages
Last checked
10 hours ago

Tools for package owners.