http

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: MIT Imports: 17 Imported by: 0

README

HTTP plugin

  • Client
  • Server

Documentation

Index

Constants

View Source
const (
	HeaderContentType   = "Content-Type"
	MIMEApplicationJSON = "application/json"
	MIMEApplicationXML  = "application/xml"
	MIMETextXML         = "text/xml"
	MimeTextPlain       = "text/plain"
	MIMETextHTML        = "text/html"
	MIMEApplicationForm = "application/x-www-form-urlencoded"
	MIMEMultipartForm   = "multipart/form-data"
)
View Source
const (
	ServerComponent    string = "http_server"
	ServerResponsePort        = "response"
	ServerRequestPort         = "request"
	ServerControlPort         = "control"
	ServerStatusPort          = "status"
)
View Source
const ClientComponent = "http_client"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
}

func (Client) GetInfo

func (h Client) GetInfo() module.ComponentInfo

func (Client) Handle

func (h Client) Handle(ctx context.Context, handler module.Handler, port string, message interface{}) error

func (Client) Instance

func (h Client) Instance() module.Component

func (Client) Ports

func (h Client) Ports() []module.NodePort

type ClientRequest

type ClientRequest struct {
	Context ClientRequestContext `json:"context" configurable:"true" title:"Context" description:"Message to be sent further" propertyOrder:"1"`
	Request `json:"request" title:"HTTP request" required:"true" propertyOrder:"2"`
}

type ClientRequestBody added in v0.1.5

type ClientRequestBody any

type ClientRequestContext

type ClientRequestContext any

type ClientResponse

type ClientResponse struct {
	Request ClientRequest `json:"request"`
}

type ContentType

type ContentType string

func (ContentType) JSONSchema

func (c ContentType) JSONSchema() (jsonschema.Schema, error)
type Header struct {
	Key   string `json:"key" required:"true" title:"Key" colSpan:"col-span-6"`
	Value string `json:"value" required:"true" title:"Value" colSpan:"col-span-6"`
}

type Request added in v0.1.5

type Request struct {
	Method  string            `` /* 155-byte string literal not displayed */
	URL     string            `json:"url" required:"true" title:"URL" format:"uri" propertyOrder:"2"`
	Headers []Header          `json:"headers" required:"true" title:"Headers" propertyOrder:"3"`
	Body    ClientRequestBody `json:"body" configurable:"true" title:"Request Body" propertyOrder:"4"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func (*Server) GetInfo

func (h *Server) GetInfo() module.ComponentInfo

func (*Server) HTTPService added in v0.1.5

func (h *Server) HTTPService(getter module.ListenAddressGetter)

func (*Server) Handle

func (h *Server) Handle(ctx context.Context, handler module.Handler, port string, msg interface{}) error

func (*Server) Instance

func (h *Server) Instance() module.Component

func (*Server) Ports

func (h *Server) Ports() []module.NodePort

func (*Server) Run added in v0.1.5

func (h *Server) Run(ctx context.Context, handler module.Handler) error

type ServerControlRequest added in v0.1.5

type ServerControlRequest struct {
	Start bool `json:"start" required:"true" title:"Server state"`
}

type ServerRequest

type ServerRequest struct {
	RequestID     string     `json:"requestID" required:"true"`
	RequestURI    string     `json:"requestURI" required:"true"`
	RequestParams url.Values `json:"requestParams" required:"true"`
	Host          string     `json:"host" required:"true"`
	Method        string     `json:"method" required:"true" title:"Method" enum:"GET,POST,PATCH,PUT,DELETE" enumTitles:"GET,POST,PATCH,PUT,DELETE"`
	RealIP        string     `json:"realIP"`
	Headers       []Header   `json:"headers,omitempty"`
	Body          any        `json:"body"`
	Scheme        string     `json:"scheme"`
}

type ServerResponse

type ServerResponse struct {
	RequestID   string             `` /* 161-byte string literal not displayed */
	StatusCode  int                `json:"statusCode" required:"true" title:"Status Code" description:"HTTP status code for response" propertyOrder:"2"`
	ContentType ContentType        `json:"contentType" required:"true" propertyOrder:"3"`
	Headers     []Header           `json:"headers"  title:"Response headers" propertyOrder:"4"`
	Body        ServerResponseBody `json:"body" title:"Response body" configurable:"true" propertyOrder:"5"`
}

type ServerResponseBody

type ServerResponseBody any

type ServerSettings

type ServerSettings struct {
	ListenAddr        string `json:"listenAddr" required:"true" title:"Listen Address"`
	WriteTimeout      int    `` /* 160-byte string literal not displayed */
	EnableControlPort bool   `` /* 128-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (ServerSettings) PrepareJSONSchema added in v0.1.5

func (s ServerSettings) PrepareJSONSchema(schema *jsonschema.Schema) error

type ServerStatus

type ServerStatus struct {
	ListenAddr string `json:"listenAddr" readonly:"true" title:"Listen Address"`
}

Jump to

Keyboard shortcuts

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