httpserver

package
v1.0.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: Apache-2.0 Imports: 13 Imported by: 30

Documentation

Index

Constants

View Source
const (
	MIMEApplicationVendorIOTASerializerV1 = "application/vnd.iota.serializer-v1"
	ProtocolHTTP                          = "http"
	ProtocolHTTPS                         = "https"
	ProtocolWS                            = "ws"
	ProtocolWSS                           = "wss"
)

Variables

View Source
var (
	// ErrInvalidParameter defines the invalid parameter error.
	ErrInvalidParameter = echo.NewHTTPError(http.StatusBadRequest, "invalid parameter")

	// ErrNotAcceptable defines the not acceptable error.
	ErrNotAcceptable = echo.NewHTTPError(http.StatusNotAcceptable)
)

Functions

func GetAcceptHeaderContentType

func GetAcceptHeaderContentType(c echo.Context, supportedContentTypes ...string) (string, error)

func GetRequestContentType

func GetRequestContentType(c echo.Context, supportedContentTypes ...string) (string, error)

func GetURL

func GetURL(protocol string, host string, port uint16, path ...string) string

func JSONResponse

func JSONResponse(c echo.Context, statusCode int, result interface{}) error

JSONResponse sends the JSON response with status code.

func NewEcho

func NewEcho(logger *logger.Logger, onHTTPError func(err error, c echo.Context), debugRequestLoggerEnabled bool) *echo.Echo

NewEcho returns a new Echo instance. It hides the banner, adds a default HTTPErrorHandler and the Recover middleware.

func ParseAliasIDParam

func ParseAliasIDParam(c echo.Context, paramName string) (*iotago.AliasID, error)

func ParseBech32AddressQueryParam

func ParseBech32AddressQueryParam(c echo.Context, prefix iotago.NetworkPrefix, paramName string) (iotago.Address, error)

func ParseBlockIDParam

func ParseBlockIDParam(c echo.Context, paramName string) (iotago.BlockID, error)

func ParseBoolQueryParam

func ParseBoolQueryParam(c echo.Context, paramName string) (bool, error)

func ParseFoundryIDParam

func ParseFoundryIDParam(c echo.Context, paramName string) (*iotago.FoundryID, error)

func ParseHexQueryParam

func ParseHexQueryParam(c echo.Context, paramName string, maxLen int) ([]byte, error)

func ParseMilestoneIDParam

func ParseMilestoneIDParam(c echo.Context, paramName string) (*iotago.MilestoneID, error)

func ParseMilestoneIndexParam

func ParseMilestoneIndexParam(c echo.Context, paramName string) (iotago.MilestoneIndex, error)

func ParseNFTIDParam

func ParseNFTIDParam(c echo.Context, paramName string) (*iotago.NFTID, error)

func ParseOutputIDParam

func ParseOutputIDParam(c echo.Context, paramName string) (iotago.OutputID, error)

func ParseTransactionIDParam

func ParseTransactionIDParam(c echo.Context, paramName string) (iotago.TransactionID, error)

func ParseUint32QueryParam

func ParseUint32QueryParam(c echo.Context, paramName string, maxValue ...uint32) (uint32, error)

func ParseUnixTimestampQueryParam

func ParseUnixTimestampQueryParam(c echo.Context, paramName string) (time.Time, error)

Types

type HTTPErrorResponse

type HTTPErrorResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

HTTPErrorResponse defines the error struct for the HTTPErrorResponseEnvelope.

type HTTPErrorResponseEnvelope

type HTTPErrorResponseEnvelope struct {
	Error HTTPErrorResponse `json:"error"`
}

HTTPErrorResponseEnvelope defines the error response schema for node API responses.

Jump to

Keyboard shortcuts

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