packaging

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package packaging provides functions to convert to and from http.Request/Response and json marshallable equivalents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnpackageHttpRequest

func UnpackageHttpRequest(h *HttpRequest) (*http.Request, error)

func UnpackageHttpResponse

func UnpackageHttpResponse(h *HttpResponse, req *http.Request) (*http.Response, error)

Types

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

type HttpRequest

type HttpRequest struct {
	Method      string        `json:"method"`
	URL         string        `json:"url"`
	Host        string        `json:"host"`
	Path        string        `json:"path"`
	QueryString string        `json:"query_string"`
	Scheme      string        `json:"scheme"`
	Body        string        `json:"body"`
	ID          string        `json:"id"`
	LocalID     int64         `json:"local_id"`
	Headers     []KeyValue    `json:"headers"`
	Query       []KeyValue    `json:"query"`
	Tags        []string      `json:"tags"`
	Response    *HttpResponse `json:"response"`
}

func PackageHttpRequest

func PackageHttpRequest(request *http.Request, proxyID string, reqID int64) (*HttpRequest, error)

type HttpResponse

type HttpResponse struct {
	Body       string       `json:"body"`
	StatusCode int          `json:"status_code"`
	ID         string       `json:"id"`
	LocalID    int64        `json:"local_id"`
	Headers    []KeyValue   `json:"headers"`
	Tags       []string     `json:"tags"`
	BodySize   int          `json:"body_size"`
	Cookies    []KeyValue   `json:"cookies"`
	Request    *HttpRequest `json:"request"`
}

func PackageHttpResponse

func PackageHttpResponse(response *http.Response, proxyID string, reqID int64) (*HttpResponse, error)

type KeyValue

type KeyValue struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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