Documentation
¶
Index ¶
- Constants
- Variables
- func CloneBytes(b []byte) []byte
- func DealUploadFilePath(ctx context.Context, uploadReader FileReader, postFileCh chan *UploadChanValue, ...)
- func ErrorIf(b bool, err1, err2 error) error
- func FindReplaceFunc(subject, search string, repl func(string) string) string
- func FoldFindReplace(subject, search, replace string) (string, bool)
- func FoldReplace(subject, search, replace string) string
- func Gen(s string, mode StringMode) string
- func Hjson2Json(s []byte) ([]byte, error)
- func If[T any](c bool, a, b T) T
- func ParseBodyArg(body string, stream, lineMode bool) (streamFileName string, bodyBytes []byte, lines chan string)
- func ParseFileArg(arg string) (file string, data []byte)
- func Quoted(s, open, close string) (string, bool)
- func ReadFileFromPos(f *os.File, pos int64) ([]byte, error)
- func SetHeader(r *fasthttp.Request, header, value string)
- func ThroughputStatDial(wrap NetworkWrapper, dial fasthttp.DialFunc, r, w *int64) fasthttp.DialFunc
- type ChanUploadChanValueReader
- type Closers
- type DataItem
- type EnvVars
- type FileReader
- type LogFile
- type MyConn
- type NetworkWrapper
- type Option
- type Profile
- type RangeValue
- type SingleValue
- type StringMode
- type Tag
- type TagValue
- type UploadChanValue
- type UploadChanValueReader
- type UploadChanValueType
- type ValUploadChanValueReader
Constants ¶
View Source
const ( ContentTypeName = "Content-Type" ContentTypeJSON = "application/json;charset=utf-8" )
Variables ¶
View Source
var Debug = ss.Must(ss.GetenvBool("DEBUG", false))
View Source
var DemoProfile []byte
View Source
var Valuer = jj.NewCachingSubstituter()
Functions ¶
func CloneBytes ¶
func DealUploadFilePath ¶
func DealUploadFilePath(ctx context.Context, uploadReader FileReader, postFileCh chan *UploadChanValue, cache bool)
func FindReplaceFunc ¶
func FoldFindReplace ¶
func FoldReplace ¶
func Gen ¶
func Gen(s string, mode StringMode) string
func Hjson2Json ¶
func ParseBodyArg ¶
func ParseFileArg ¶
ParseFileArg parse an argument which represents a string content, or @file to represents the file's content.
func ThroughputStatDial ¶
Types ¶
type ChanUploadChanValueReader ¶
type ChanUploadChanValueReader struct {
Chan chan UploadChanValue
}
func (*ChanUploadChanValueReader) ReadUploadChanValue ¶
func (c *ChanUploadChanValueReader) ReadUploadChanValue() UploadChanValue
type DataItem ¶
type DataItem struct {
Payload util.UploadPayload
}
type FileReader ¶
type FileReader interface { Read(cache bool) *UploadChanValue Start(ctx context.Context) }
func CreateFileReader ¶
func CreateFileReader(uploadFileField, upload, saveRandDir string, ant bool) FileReader
type LogFile ¶
type LogFile struct { File *os.File Pos int64 sync.Mutex // contains filtered or unexported fields }
func CreateLogFile ¶
func (*LogFile) GetLastLog ¶
func (*LogFile) WriteString ¶
type NetworkWrapper ¶
func NetworkWrap ¶
func NetworkWrap(network string) NetworkWrapper
type Option ¶
type Option struct { // 从结果 JSON 中 使用 jj.Get 提取值, 参见 demo.http 中写法 // 例如:result.id=chinaID,表示设置 @id = jj.Get(responseJSON, "chinaID") // 一般配合初始化调用使用,例如从登录结果中提取 accessToken 等 ResultExpr map[string]string `prefix:"result."` SourceExpr map[string]string `prefix:"source."` Asserts map[string]string `prefix:"assert."` Tag string Eval bool GoTemplate bool Init bool // 作为初始化调用,例如登录 JsonBody bool Template *template.Template }
func (*Option) ResultJSONValuer ¶
type Profile ¶
type Profile struct { Option Query map[string]string RawJSON map[string]string Form map[string]string Header map[string]string EnvVars EnvVars Body string URL string Method string Comments []string // contains filtered or unexported fields }
func ParseProfileArg ¶
func ParseProfileFile ¶
type RangeValue ¶
func (*RangeValue) Contains ¶
func (r *RangeValue) Contains(s string) bool
type SingleValue ¶
type SingleValue struct {
Value string
}
func (SingleValue) Contains ¶
func (v SingleValue) Contains(s string) bool
type TagValue ¶
func NewRangeValue ¶
type UploadChanValue ¶
type UploadChanValue struct { Data func() *DataItem Path string ContentType string Type UploadChanValueType UploadExit bool }
func (UploadChanValue) GetCachePath ¶
func (v UploadChanValue) GetCachePath() string
type UploadChanValueReader ¶
type UploadChanValueReader interface {
ReadUploadChanValue() UploadChanValue
}
type UploadChanValueType ¶
type UploadChanValueType int
const ( NormalFile UploadChanValueType = iota DirectBytes )
type ValUploadChanValueReader ¶
type ValUploadChanValueReader struct {
Value UploadChanValue
}
func (*ValUploadChanValueReader) ReadUploadChanValue ¶
func (c *ValUploadChanValueReader) ReadUploadChanValue() UploadChanValue
Source Files
¶
Click to show internal directories.
Click to hide internal directories.