harv2

package
v0.0.0-...-36d6306 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RawBodyCheck                 = "application/json"
	FormBodyCheck                = "multipart/form-data"
	UrlEncodedBodyCheck          = "application/x-www-form-urlencoded"
	TimestampSequencingThreshold = 50 * time.Millisecond // Connect requests within 50ms for better sequencing
)

Constants for processing behavior

View Source
const DescriptionImportedFromHAR = "Imported from HAR"

Variables

This section is empty.

Functions

func CreateDeltaBodyForms

func CreateDeltaBodyForms(originalForms []mhttp.HTTPBodyForm, newForms []mhttp.HTTPBodyForm, deltaHttpID idwrap.IDWrap) []mhttp.HTTPBodyForm

CreateDeltaBodyForms creates delta body forms when HAR forms differ from base request

func CreateDeltaBodyRaw

func CreateDeltaBodyRaw(originalRaw *mhttp.HTTPBodyRaw, newRaw *mhttp.HTTPBodyRaw, deltaHttpID idwrap.IDWrap) *mhttp.HTTPBodyRaw

CreateDeltaBodyRaw creates delta raw body when HAR differs from base request

func CreateDeltaBodyUrlEncoded

func CreateDeltaBodyUrlEncoded(originalEncoded []mhttp.HTTPBodyUrlencoded, newEncoded []mhttp.HTTPBodyUrlencoded, deltaHttpID idwrap.IDWrap) []mhttp.HTTPBodyUrlencoded

CreateDeltaBodyUrlEncoded creates delta URL-encoded body when HAR differs from base request

func CreateDeltaHeaders

func CreateDeltaHeaders(originalHeaders []mhttp.HTTPHeader, newHeaders []mhttp.HTTPHeader, deltaHttpID idwrap.IDWrap) []mhttp.HTTPHeader

CreateDeltaHeaders creates delta headers when HAR headers differ from base request

func CreateDeltaSearchParams

func CreateDeltaSearchParams(originalParams []mhttp.HTTPSearchParam, newParams []mhttp.HTTPSearchParam, deltaHttpID idwrap.IDWrap) []mhttp.HTTPSearchParam

CreateDeltaSearchParams creates delta search params when HAR params differ from base request

func ReorganizeNodePositions

func ReorganizeNodePositions(result *HarResolved) error

ReorganizeNodePositions positions flow nodes using a level-based horizontal layout. Sequential nodes flow left-to-right, parallel nodes are stacked vertically. Uses the shared flowgraph package for layout calculation.

Types

type Content

type Content struct {
	Size     int    `json:"size"`
	MimeType string `json:"mimeType"`
	Text     string `json:"text"`
}

Content represents the response body content

type Entry

type Entry struct {
	StartedDateTime time.Time `json:"startedDateTime"`
	ResourceType    string    `json:"_resourceType"`
	Request         Request   `json:"request"`
	Response        Response  `json:"response"`
}

Entry represents a single HTTP request/response pair

type HAR

type HAR struct {
	Log Log `json:"log"`
}

HAR represents the structure of a HAR (HTTP Archive) file

func ConvertRaw

func ConvertRaw(data []byte) (*HAR, error)

ConvertRaw parses raw HAR data into our HAR structure

type HarResolved

type HarResolved struct {
	// HTTP Requests (modern mhttp.HTTP model)
	HTTPRequests []mhttp.HTTP `json:"http_requests"`

	// Child Entities
	HTTPHeaders        []mhttp.HTTPHeader         `json:"http_headers"`
	HTTPSearchParams   []mhttp.HTTPSearchParam    `json:"http_search_params"`
	HTTPBodyForms      []mhttp.HTTPBodyForm       `json:"http_body_forms"`
	HTTPBodyUrlEncoded []mhttp.HTTPBodyUrlencoded `json:"http_body_urlencoded"`
	HTTPBodyRaws       []mhttp.HTTPBodyRaw        `json:"http_body_raws"`
	HTTPAsserts        []mhttp.HTTPAssert         `json:"http_asserts"`

	// File System (modern mfile.File model)
	Files []mfile.File `json:"files"`

	// Flow Items (preserving existing flow generation)
	Flow         mflow.Flow          `json:"flow"`
	Nodes        []mflow.Node        `json:"nodes"`
	RequestNodes []mflow.NodeRequest `json:"request_nodes"`
	Edges        []mflow.Edge        `json:"edges"`
}

HarResolved represents the complete translated result using modern models

func ConvertHAR

func ConvertHAR(har *HAR, workspaceID idwrap.IDWrap) (*HarResolved, error)

ConvertHAR is the main entry point for HAR conversion using modern architecture This is the primary function that replaces the legacy ConvertHAR from thar package

func ConvertHARWithDepFinder

func ConvertHARWithDepFinder(har *HAR, workspaceID idwrap.IDWrap, depFinder *depfinder.DepFinder) (*HarResolved, error)

ConvertHARWithDepFinder converts HAR with dependency finding support

func ConvertHARWithDepFinderAndService

func ConvertHARWithDepFinderAndService(ctx context.Context, har *HAR, workspaceID idwrap.IDWrap, depFinder *depfinder.DepFinder, httpService *shttp.HTTPService) (*HarResolved, error)

ConvertHARWithDepFinderAndService converts HAR with dependency finding and overwrite detection

func ConvertHARWithService

func ConvertHARWithService(ctx context.Context, har *HAR, workspaceID idwrap.IDWrap, httpService *shttp.HTTPService) (*HarResolved, error)

ConvertHARWithService converts HAR with overwrite detection using HTTP service This is the enhanced function that prevents duplicates and creates proper deltas

type Header struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Header represents an HTTP header

type Log

type Log struct {
	Entries []Entry `json:"entries"`
}

Log contains the entries of a HAR file

type Param

type Param struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Param represents a form parameter

type PostData

type PostData struct {
	MimeType string  `json:"mimeType"`
	Text     string  `json:"text"`
	Params   []Param `json:"params,omitempty"`
}

PostData represents the request body data

type Query

type Query struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Query represents a URL query parameter

type Request

type Request struct {
	Method      string    `json:"method"`
	URL         string    `json:"url"`
	HTTPVersion string    `json:"httpVersion"`
	Headers     []Header  `json:"headers"`
	PostData    *PostData `json:"postData,omitempty"`
	QueryString []Query   `json:"queryString"`
}

Request represents the HTTP request information

type Response

type Response struct {
	Status      int      `json:"status"`
	StatusText  string   `json:"statusText"`
	HTTPVersion string   `json:"httpVersion"`
	Headers     []Header `json:"headers"`
	Content     Content  `json:"content"`
}

Response represents the HTTP response information

Jump to

Keyboard shortcuts

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