transformer

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultReqTransformation

func DefaultReqTransformation(userUrl string, rec reqreader.ReqRecord) (sender.Request, error)

DefaultReqTransformation is a transformation that should be used by default if a custom transformation is not provided. If we don't have a header in the CSV file, the transformation expects the data to be in the following order: URL, HTTP method, headers (in JSON format), body. If we do have a header, then it will look for these fields: url, method, headers, and body.

func TransformRequests

func TransformRequests(userUrls []string, input <-chan reqreader.ReqRecord, transformation ReqTransformation) <-chan sender.Request

TransformRequests reads raw request data from the input channel, transforms it into requests using the given transformation and sends it to the output channel.

Types

type ReqTransformation

type ReqTransformation func(userUrl string, rec reqreader.ReqRecord) (sender.Request, error)

ReqTransformation is a function that transforms an input record to an HTTP request.

func NewReqTransformation

func NewReqTransformation(script string) (ReqTransformation, error)

NewReqTransformation creates a new transformation from the given JavaScript code. The script must have a function called 'transform' that accepts a user url and a CSV record, and returns an HTTP request.

Jump to

Keyboard shortcuts

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