http

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package http is a wrapper packages of net/http for net-upnp-go.

Index

Constants

View Source
const (
	GET         = "GET"
	POST        = "POST"
	SUBSCRIBE   = "SUBSCRIBE"
	UNSUBSCRIBE = "UNSUBSCRIBE"

	UserAgent    = "User-Agent"
	ContentType  = "Content-Type"
	ServerHeader = "Server"

	SOAPAction      = "SOAPACTION"
	SOAPActionDelim = "#"

	ContentTypeXML = "text/xml; charset=\"utf-8\""
)
View Source
const (
	DefaultTimeout = 60
	MaxHeaderBytes = 1 << 20
)
View Source
const (
	StatusOK                  = gohttp.StatusOK
	StatusBadRequest          = gohttp.StatusBadRequest
	StatusNotFound            = gohttp.StatusNotFound
	StatusPreconditionFailed  = gohttp.StatusPreconditionFailed
	StatusInternalServerError = gohttp.StatusInternalServerError
)

Variables

This section is empty.

Functions

func GetServerName

func GetServerName() string

func StatusCodeToString

func StatusCodeToString(code int) string

Types

type Client

type Client struct {
	*gohttp.Client
}

A Client represents a Client.

func NewClient

func NewClient() (*Client, error)

NewRequest returns a new Request.

func (*Client) Do

func (client *Client) Do(req *Request) (*Response, error)

type Request

type Request struct {
	*gohttp.Request
}

A Request represents a Request.

func NewRequest

func NewRequest(method, urlStr string, body io.Reader) (*Request, error)

NewRequest returns a new Request.

func NewRequestFromRequest

func NewRequestFromRequest(req *gohttp.Request) *Request

NewRequest returns a new Request.

func NewSOAPRequest

func NewSOAPRequest(url *url.URL, soapAction string, body io.Reader) (*Request, error)

NewSOAPRequest returns a new Request.

func (*Request) GetSOAPServiceActionName

func (req *Request) GetSOAPServiceActionName() (string, bool)

func (*Request) IsSOAPRequest

func (req *Request) IsSOAPRequest() bool

type RequestListener

type RequestListener interface {
	HTTPRequestReceived(*Request, ResponseWriter)
}

A SSDPListener represents a listener for Server.

type Response

type Response struct {
	*gohttp.Response
}

A Response represents a Response.

func Get

func Get(url string) (*Response, error)

func NewResponse

func NewResponse(req *gohttp.Response) *Response

NewResponse returns a new Response.

func NewResponseFromResponse

func NewResponseFromResponse(req *gohttp.Response) *Response

NewResponse returns a new Response.

type ResponseWriter

type ResponseWriter interface {
	gohttp.ResponseWriter
}

A ResponseWriter represents a ResponseWriter.

type Server

type Server struct {
	*gohttp.Server
	Conn     net.Listener
	Listener RequestListener
}

A Server represents a Server.

func NewServer

func NewServer() *Server

NewServer returns a new Server.

func (*Server) ServeHTTP

func (server *Server) ServeHTTP(res gohttp.ResponseWriter, req *gohttp.Request)

ServeHTTP is a handler.

func (*Server) Start

func (server *Server) Start(port int) error

Start starts this server.

func (*Server) Stop

func (server *Server) Stop() error

Stop stops this server.

Jump to

Keyboard shortcuts

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