Documentation
¶
Index ¶
- Constants
- func LogPreparedRequest(ctx context.Context, logger *slog.Logger, executionID, nodeID idwrap.IDWrap, ...)
- func PrepareRequest(endpoint mhttp.HTTP, example mhttp.HTTP, queries []mhttp.HTTPSearchParam, ...) (*httpclient.Request, error)
- type MergeExamplesInput
- type MergeExamplesOutput
- type PrepareHTTPRequestResult
- type PrepareRequestResult
- type RequestResponse
- type RequestResponseVar
Constants ¶
View Source
const ( HeaderContentEncoding = "Content-Encoding" HeaderContentType = "Content-Type" EncodingGzip = "gzip" EncodingZstd = "zstd" EncodingDeflate = "deflate" EncodingIdentity = "identity" EncodingBr = "br" MimeOctetStream = "application/octet-stream" MimeJSON = "application/json" MimeXML = "application/xml" MimeTextPlain = "text/plain" MimeTextHTML = "text/html" MimeFormUrlEncoded = "application/x-www-form-urlencoded" )
Variables ¶
This section is empty.
Functions ¶
func LogPreparedRequest ¶
func PrepareRequest ¶
func PrepareRequest(endpoint mhttp.HTTP, example mhttp.HTTP, queries []mhttp.HTTPSearchParam, headers []mhttp.HTTPHeader, rawBody mhttp.HTTPBodyRaw, formBody []mhttp.HTTPBodyForm, urlBody []mhttp.HTTPBodyUrlencoded, varMap varsystem.VarMap, ) (*httpclient.Request, error)
Types ¶
type MergeExamplesInput ¶
type MergeExamplesInput struct {
Base, Delta mhttp.HTTP
BaseQueries, DeltaQueries []mhttp.HTTPSearchParam
BaseHeaders, DeltaHeaders []mhttp.HTTPHeader
// Bodies
BaseRawBody, DeltaRawBody mhttp.HTTPBodyRaw
BaseFormBody, DeltaFormBody []mhttp.HTTPBodyForm
BaseUrlEncodedBody, DeltaUrlEncodedBody []mhttp.HTTPBodyUrlencoded
BaseAsserts, DeltaAsserts []mhttp.HTTPAssert
}
type MergeExamplesOutput ¶
type MergeExamplesOutput struct {
Merged mhttp.HTTP
MergeQueries []mhttp.HTTPSearchParam
MergeHeaders []mhttp.HTTPHeader
MergeRawBody mhttp.HTTPBodyRaw
MergeFormBody []mhttp.HTTPBodyForm
MergeUrlEncodedBody []mhttp.HTTPBodyUrlencoded
MergeAsserts []mhttp.HTTPAssert
}
func MergeExamples ¶
func MergeExamples(input MergeExamplesInput) MergeExamplesOutput
Function will merge two examples but ID will be the same as the base example
type PrepareHTTPRequestResult ¶
type PrepareHTTPRequestResult struct {
Request *httpclient.Request
ReadVars map[string]any // Variables that were read during request preparation
}
PrepareHTTPRequestResult holds the result of preparing a request with tracked variable usage
func PrepareHTTPRequestWithTracking ¶
func PrepareHTTPRequestWithTracking( httpReq mhttp.HTTP, headers []mhttp.HTTPHeader, params []mhttp.HTTPSearchParam, rawBody *mhttp.HTTPBodyRaw, formBody []mhttp.HTTPBodyForm, urlBody []mhttp.HTTPBodyUrlencoded, varMap map[string]any, ) (*PrepareHTTPRequestResult, error)
PrepareHTTPRequestWithTracking prepares a request using mhttp models and tracks variable usage. Uses expression.UnifiedEnv for variable interpolation, supporting:
- {{ varKey }} - Variable references
- {{ now() }} - Function calls
- {{ a + b }} - Expressions
- {{ #env:VAR }} - Environment variables
- {{ #file:/path }} - File contents
type PrepareRequestResult ¶
type PrepareRequestResult struct {
Request *httpclient.Request
ReadVars map[string]string // Variables that were read during request preparation
}
PrepareRequestResult holds the result of preparing a request with tracked variable usage
func PrepareRequestWithTracking ¶
func PrepareRequestWithTracking(endpoint mhttp.HTTP, example mhttp.HTTP, queries []mhttp.HTTPSearchParam, headers []mhttp.HTTPHeader, rawBody mhttp.HTTPBodyRaw, formBody []mhttp.HTTPBodyForm, urlBody []mhttp.HTTPBodyUrlencoded, varMap varsystem.VarMap, ) (*PrepareRequestResult, error)
PrepareRequestWithTracking prepares a request and tracks which variables are read
type RequestResponse ¶
type RequestResponse struct {
HttpResp httpclient.Response
LapTime time.Duration
}
func SendRequest ¶
func SendRequest(req *httpclient.Request, exampleID idwrap.IDWrap, client httpclient.HttpClient) (*RequestResponse, error)
func SendRequestWithContext ¶
func SendRequestWithContext(ctx context.Context, req *httpclient.Request, exampleID idwrap.IDWrap, client httpclient.HttpClient) (*RequestResponse, error)
type RequestResponseVar ¶
type RequestResponseVar struct {
Method string `json:"method"`
URL string `json:"url"`
Headers map[string]string `json:"headers"`
Queries map[string]string `json:"queries"`
Body string `json:"body"`
}
func ConvertRequestToVar ¶
func ConvertRequestToVar(r *httpclient.Request) RequestResponseVar
Click to show internal directories.
Click to hide internal directories.